computed内数据重新赋值导致报错
computed: {
treeData:function(){
return this.treeNodes
},
},
watch: {
treeNodes(data, oldData) {
if (data !== oldData) {
this.treeData = data;
}
}
},
报错:Computed property “treeData” was assigned to but it has no setter.
解决方案
computed: {
treeData:{
get:function(){
return this.treeNodes
},
set:function(newData){
return newData
}
},
},