When I try clicking checkbox to complete item it does nothing. Todo item remains undone.
When I try editing item text it becomes empty string after editing
Possible solution
Remove v-model directive from toggle checkbox. Because at first checkbox change completed property, then mutation change it again, so it remains same.
In Mutations only two parameters possible: state and payload. So it should be like this:
// in handleSave method inside TodoItem.vue
this.editTodo({id: this.todo.id, text: text});
// in mutations
[ActionTypes.EDIT_TODO](state, payload) {
state.todos = state.todos.map(todo =>
todo.id === payload.id ?
Object.assign({}, todo, {text: payload.text}) :
todo
);
},
Description
When I try clicking checkbox to complete item it does nothing. Todo item remains undone. When I try editing item text it becomes empty string after editing
Possible solution
Remove
v-model
directive from toggle checkbox. Because at first checkbox changecompleted
property, then mutation change it again, so it remains same.In Mutations only two parameters possible: state and payload. So it should be like this:
Config
Copy the content from
.yo-rc.json
:Environment