Skip to content

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

Open
@haizhilin2013

Description

@haizhilin2013
Collaborator

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

Activity

wenyejie

wenyejie commented on Jun 21, 2019

@wenyejie

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

NingLin00

NingLin00 commented on Jul 10, 2019

@NingLin00

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

zhengwei1949

zhengwei1949 commented on Sep 27, 2019

@zhengwei1949

在mutations中监视

WenJieLi1998

WenJieLi1998 commented on Apr 18, 2020

@WenJieLi1998

watch

tzzhmm

tzzhmm commented on Jul 21, 2020

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

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

Drikold

Drikold commented on Jul 25, 2021

@Drikold

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

yxllovewq

yxllovewq commented on Mar 10, 2022

@yxllovewq

watch、computed和devtool

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @wenyejie@haizhilin2013@Drikold@tzzhmm@zhengwei1949

        Issue actions

          [vue] 怎么监听vuex数据的变化? · Issue #391 · haizlin/fe-interview