Nuxt/examples/vuex-store-modules/store/todos.js
Sébastien Chopin e01093b2ac Usage of getters
2017-02-12 11:48:16 +01:00

23 lines
285 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
}
}