监听vuex中state内某个字段的变化,触发模块中执行函数的写法
watch:{getorderid(curval,oldval){ //监听了computed中getorderid的值,如果发生改变就触发console.logconsole.log(`最新值${curval}--旧值${oldval}`);}},computed:{ //同步了store中state内的orderid值getorderid()...
·
watch:{
getorderid(curval,oldval){ //监听了computed中getorderid的值,如果发生改变就触发console.log
console.log(`最新值${curval}--旧值${oldval}`);
}
},
computed:{ //同步了store中state内的orderid值
getorderid(){
return this.$store.state.orderid;
}
}
getorderid(curval,oldval){ //监听了computed中getorderid的值,如果发生改变就触发console.log
console.log(`最新值${curval}--旧值${oldval}`);
}
},
computed:{ //同步了store中state内的orderid值
getorderid(){
return this.$store.state.orderid;
}
}
更多推荐
已为社区贡献27条内容
所有评论(0)