osm_my_commerce/store/index.ts

27 lines
526 B
TypeScript

export const state = () => ({
counter: 0,
list: [],
formConfig: {},
})
export const mutations = {
increment(state: any) {
state.counter++
},
add(state: any, text: any) {
state.list.push({
text,
done: false,
})
},
remove(state: any, { todo }: any) {
state.list.splice(state.list.indexOf(todo), 1)
},
toggle(state: any, todo: any) {
todo.done = !todo.done
},
setFormField(state: any, { field }: any) {
state.formConfig[state.formConfig.indexOf(field)] = field
},
}