There is a very strange bug today. We can see the reason for the error very clearly. The calculated attribute has no setter.
This is the source code of the calculated attribute. The calculated attribute has getter and setter. The default is only getter. You can set the setter if needed
computed:{
isActive(){
return this.$route.path.indexOf(this.path) !== -1
}
},
Although the effect is still achievable, it will report an error every time I use the data. I read the official vue documentation and the
official demo does not have a setter. Why should I report an error if I don't set the setter?
The final modification plan:
computed:{
isActive:{
get(){
return this.$route.path.indexOf(this.path) !== -1
},
set(val){
}
}
},