tweak setLocalStorgae -> setLocalStorage (#894)

This commit is contained in:
mimimi 2018-07-20 16:02:38 +08:00 committed by 花裤衩
parent 878628b0ed
commit 8851a68066
1 changed files with 7 additions and 7 deletions

View File

@ -72,7 +72,7 @@ export default {
}
},
methods: {
setLocalStorgae() {
setLocalStorage() {
window.localStorage.setItem(STORAGE_KEY, JSON.stringify(this.todos))
},
addTodo(e) {
@ -82,30 +82,30 @@ export default {
text,
done: false
})
this.setLocalStorgae()
this.setLocalStorage()
}
e.target.value = ''
},
toggleTodo(val) {
val.done = !val.done
this.setLocalStorgae()
this.setLocalStorage()
},
deleteTodo(todo) {
this.todos.splice(this.todos.indexOf(todo), 1)
this.setLocalStorgae()
this.setLocalStorage()
},
editTodo({ todo, value }) {
todo.text = value
this.setLocalStorgae()
this.setLocalStorage()
},
clearCompleted() {
this.todos = this.todos.filter(todo => !todo.done)
this.setLocalStorgae()
this.setLocalStorage()
},
toggleAll({ done }) {
this.todos.forEach(todo => {
todo.done = done
this.setLocalStorgae()
this.setLocalStorage()
})
}
},