computed:{
		listenfooterInfo() {
			return this.$store.state.footerTag.footerInfo[0];
		}
    },

首先用计算属性将要监听的数据赋值在listenfooterInfo上

    watch: {
        listenfooterInfo: {
        handler(new,old) { //特别注意,不能用箭头函数,箭头函数,this指向全局
            this.color= new
        },
        immediate: true,  //刷新加载 立马触发一次handler
        deep: true  // 可以深度检测到 obj 对象的属性值的变化
        }
    },

然后在watch中监听如下

Logo

前往低代码交流专区

更多推荐