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

23 lines
285 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
})
},
2017-01-09 14:10:01 +00:00
toggle (state, todo) {
2016-12-25 20:16:30 +00:00
todo.done = !todo.done
}
}
2017-02-12 10:48:07 +00:00
export const getters = {
todos (state) {
return state.list
}
}