Vuex - Do not mutate vuex store state outside mutation handlers

后端 未结 1 435
被撕碎了的回忆
被撕碎了的回忆 2021-01-03 23:24

Why do I get this error:

Error [vuex] Do not mutate vuex store state outside mutation handlers.

What does it mean?

相关标签:
1条回答
  • 2021-01-03 23:30

    It could be a bit tricky to use v-model on a piece of state that belongs to Vuex.

    and you have used v-model on todo.text here:

    <input class="edit" type="text" v-model="todo.text" v-todo-focus="todo == editedTodo" @blur="doneEdit(todo)" @keyup.enter="doneEdit(todo)" @keyup.esc="cancelEdit(todo)">
    

    use :value to read value and v-on:input or v-on:change to execute a method that perform the mutation inside an explicit Vuex mutation handler

    This issue is handled here: https://vuex.vuejs.org/en/forms.html

    0 讨论(0)
提交回复
热议问题