第一種使用 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)
}
}
}
