在js中vue监听store里的数据,怎么使用watch
3 回答

FFIVE
TA贡献1797条经验 获得超6个赞
如果想监听store中的数据,需使用computed属性配合:demo: 监听store中的count值。computed:{。test() {。return this.$store.state.count。}},watch:{。test:function (nl,ol) {。//此处即可监听到。}}。

开满天机
TA贡献1786条经验 获得超13个赞
如果想监听store中的数据,需使用computed属性配合:
demo: 监听store中的count值
computed:{
test() {
return this.$store.state.count
}},
watch:{
test:function (nl,ol) {
//此处即可监听到
}}
添加回答
举报
0/150
提交
取消