2017-05-21 13:45:21 +00:00
|
|
|
export const state = () => ({
|
2016-12-25 20:16:30 +00:00
|
|
|
list: []
|
2017-05-21 13:45:21 +00:00
|
|
|
})
|
2016-12-25 20:16:30 +00:00
|
|
|
|
|
|
|
export const mutations = {
|
2017-10-31 13:43:55 +00:00
|
|
|
add(state, { text }) {
|
2016-12-25 20:16:30 +00:00
|
|
|
state.list.push({
|
|
|
|
text,
|
|
|
|
done: false
|
|
|
|
})
|
|
|
|
},
|
|
|
|
|
2017-10-31 13:43:55 +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 = {
|
2017-10-31 13:43:55 +00:00
|
|
|
todos(state) {
|
2017-02-12 10:48:07 +00:00
|
|
|
return state.list
|
|
|
|
}
|
|
|
|
}
|