vue2_frontend/src/store/todo.store.js
2022-09-16 18:44:53 +09:00

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 }