Computed property "XXX" was assigned to but it has no setter

报错视图:

Computed property

Computed property

原因:

  1. 组件中v-model=“XXX”,而XXX是vuex state中的某个变量
  2. vuex中是单项流,v-model是vue中的双向绑定,但是在computed中只通过get获取参数值,没有set无法改变参数值

解决方法:
1.在computed中添加get和set

Computed property
2.将v-model改成:value

你可能感兴趣的:(vue.js,vuex)