vue监听全局变量

可能因为格式的问题,无法再组件里面直接监听全局变量,通过compute属性来更新

computed: {
      listenshowpage1() {
        return this.$store.state.topath;
      }
    },
    watch:{
      listenshowpage1:function(old,newd){
        console.log(old)
          this.temp = old;
         }
    }

猜你喜欢

转载自blog.csdn.net/A873054267/article/details/86532320