猿问

您好,请问一下在js中vue监听store里的数据,怎么使用watch?

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

慕后森
浏览 1673回答 3
3回答

FFIVE

如果想监听store中的数据,需使用computed属性配合:demo: 监听store中的count值。computed:{。test() {。return this.$store.state.count。}},watch:{。test:function (nl,ol) {。//此处即可监听到。}}。

开满天机

如果想监听store中的数据,需使用computed属性配合:demo: 监听store中的count值computed:{test() {return this.$store.state.count}},watch:{test:function (nl,ol) {//此处即可监听到}}

慕虎7371278

$store.state.变量名称
随时随地看视频慕课网APP
我要回答