在使用vue中的computed时,在data里定义了相同的msg名字,就会出现这种情况。
解决方法是:把data里的同名数据删除即可。

代码:

data(){
        return {
            city:''//这里也有一个city
        }
    },
   computed:{
       city : function(){ //这里有个city
           return this.$store.state.city
       }
   }

导致错误:
The computed property “city” is already defined in data.

Logo

前往低代码交流专区

更多推荐