Nuxt/examples/vuex-store-modules/store/todos.js
2017-05-21 15:45:21 +02:00

23 lines
293 B
JavaScript

export const state = () => ({
list: []
})
export const mutations = {
add (state, { text }) {
state.list.push({
text,
done: false
})
},
toggle (state, todo) {
todo.done = !todo.done
}
}
export const getters = {
todos (state) {
return state.list
}
}