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

23 lines
293 B
JavaScript
Raw Normal View History

export const state = () => ({
2016-12-25 20:16:30 +00:00
list: []
})
2016-12-25 20:16:30 +00:00
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
}
}