Computed property was assigned to but it has no setter问题解决
提示此问题,是因为在computed 里面定义的属性 只有一个return返回。因为在其他地方进行了赋值操作,导致提示此错误!如下代码所示:
更改之前的代码:
computed: {
drCountData() {
return this.$store.state.drCountData;
},
},
- 1
- 2
- 3
- 4
- 5
解决办法:修改成如下的代码:
computed: {
drCountData: {
get(){
return this.$store.state.drCountData;
},
set(v) {
this.countData = v
}
},
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12