Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[vue] 怎么监听vuex数据的变化? #391

Open
haizhilin2013 opened this issue Jun 20, 2019 · 7 comments
Open

[vue] 怎么监听vuex数据的变化? #391

haizhilin2013 opened this issue Jun 20, 2019 · 7 comments
Labels
vue vue

Comments

@haizhilin2013
Copy link
Collaborator

[vue] 怎么监听vuex数据的变化?

@haizhilin2013 haizhilin2013 added the vue vue label Jun 20, 2019
@wenyejie
Copy link

wenyejie commented Jun 21, 2019

说的是内部逻辑嘛?
computed, watch?
有点忘了, mark一下,

@NingLin00
Copy link

官网的图显示 Devtools好像是监视mutation的调用 mark一下

@zhengwei1949
Copy link

在mutations中监视

@WenJieLi1998
Copy link

watch

@tzzhmm
Copy link

tzzhmm commented Jul 21, 2020

//利用计算属性
  computed: {
        nowData() {
           return this.$store.state.nowData;
        }
  },

  //监听执行
  watch: {
      nowData(val) {
         // doSomeThing
      }
  },

@Drikold
Copy link

Drikold commented Jul 25, 2021

补充 非vue文件的监听方法官方文档:https://vuex.vuejs.org/zh/api/#watch;
详细解决方法:https://www.jianshu.com/p/0989ec644908

@yxllovewq
Copy link

watch、computed和devtool

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
vue vue
Projects
None yet
Development

No branches or pull requests

8 participants