为了账号安全,请及时绑定邮箱和手机立即绑定

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

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

慕后森 2022-01-12 15:11:57
在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) {。//此处即可监听到。}}。

查看完整回答
反对 回复 2022-01-16
?
开满天机

TA贡献1786条经验 获得超13个赞

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



查看完整回答
反对 回复 2022-01-16
?
慕虎7371278

TA贡献1802条经验 获得超4个赞

$store.state.变量名称

查看完整回答
反对 回复 2022-01-16
  • 3 回答
  • 0 关注
  • 1672 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号