123456789101112131415161718192021 |
- export const STORAGE_KEY = 'todos-vuejs'
- // for testing
- if (navigator.userAgent.indexOf('PhantomJS') > -1) {
- window.localStorage.clear()
- }
- export const mutations = {
- addTodo (state, todo) {
- state.todos.push(todo)
- },
- removeTodo (state, todo) {
- state.todos.splice(state.todos.indexOf(todo), 1)
- },
- editTodo (state, { todo, text = todo.text, done = todo.done }) {
- todo.text = text
- todo.done = done
- }
- }
|