vue 监听store中的数值
第一种使用 computed 和 watch 混合模式
computed: {
isFollow() {
return this.$store.state.userId
}
},
watch: {
isFollow(newVal, oldVal) {
console.log(newVal)
}
},
第二种使用 watch 模式
watch: {
'$store.state.sys.oid'(newVal, oldVal) {
if (newVal != oldVal) {
console.log(11111111111)
}
}
}