Nuxt/examples/vuex-store-2/store/todos.js

21 lines
303 B
JavaScript
Raw Normal View History

2016-12-25 20:16:30 +00:00
export const state = {
list: []
}
export const mutations = {
add (state, { text }) {
state.list.push({
text,
done: false
})
},
delete (state, { todo }) {
state.list.splice(state.list.indexOf(todo), 1)
},
toggle (state, { todo }) {
todo.done = !todo.done
}
}