29 lines
579 B
JavaScript
29 lines
579 B
JavaScript
const state = {
|
|
total: 0,
|
|
rows: [],
|
|
selected: []
|
|
}
|
|
const getters = {
|
|
getTotal: function (state) {
|
|
return state.total
|
|
},
|
|
getRows: function (state) {
|
|
return state.rows
|
|
}
|
|
}
|
|
const mutations = {
|
|
setDatas: async function (state, datas) {
|
|
state.total = datas.total
|
|
state.rows = datas.rows
|
|
},
|
|
setSelected: function (state, datas) {
|
|
state.selected = datas
|
|
}
|
|
}
|
|
const actions = {
|
|
setDatas: async function (context, datas) {
|
|
await context.commit('setDatas', datas)
|
|
}
|
|
}
|
|
export default { namespaced: true, state, getters, mutations, actions }
|