时间:2020-12-15 00:57:26 | 栏目:vue | 点击:次
// 1.采用计算属性来获取$store中的值
computed: {
listenstage() {
return this.$store.state.iShaveMsg;
}
},
// 2.通过watch来检查定义计算属性获取到的值的变化
watch:{
listenstage: function(ov,nv){
console.log('watch start……');
if(this.$store.state.iShaveMsg){
//业务处理
}
}
console.log('watch stop……');
}
},