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