Working on VPaginator
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import { defineStore } from 'pinia'
|
||||
import { useUser } from '@/stores/user'
|
||||
import axios from '@/axios'
|
||||
import _cloneDeep from 'lodash/cloneDeep'
|
||||
|
||||
const user = useUser()
|
||||
|
||||
@@ -22,7 +23,7 @@ export const useEmployees = defineStore('employees', {
|
||||
|
||||
columns: Array<string>(),
|
||||
|
||||
limit: 10,
|
||||
limit: 1,
|
||||
page: 1,
|
||||
sort_by: '',
|
||||
simple_search: ''
|
||||
@@ -53,7 +54,7 @@ export const useEmployees = defineStore('employees', {
|
||||
)).data
|
||||
|
||||
Object.assign(this.meta, data.meta)
|
||||
this.rows = data.data.map(e => e)
|
||||
this.rows = _cloneDeep(data.data)
|
||||
|
||||
this.columns = this.fetchColumns()
|
||||
}
|
||||
@@ -69,8 +70,21 @@ export const useEmployees = defineStore('employees', {
|
||||
return []
|
||||
},
|
||||
|
||||
watch(){
|
||||
|
||||
setLimit(limit : number) {
|
||||
this.limit = limit
|
||||
this.fetchFromApi()
|
||||
},
|
||||
setSortBy(sortBy : string) {
|
||||
this.sort_by = sortBy
|
||||
this.fetchFromApi()
|
||||
},
|
||||
setSimpleSearch(simpleSearch : string) {
|
||||
this.simple_search = simpleSearch
|
||||
this.fetchFromApi()
|
||||
},
|
||||
setPage(page : number) {
|
||||
this.page = page
|
||||
this.fetchFromApi()
|
||||
}
|
||||
}
|
||||
})
|
||||
Reference in New Issue
Block a user