Skip to content

this.$store.dispatch如何调指定modules下的actions方法? #469

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

Closed
longzb opened this issue Nov 20, 2016 · 2 comments
Closed

this.$store.dispatch如何调指定modules下的actions方法? #469

longzb opened this issue Nov 20, 2016 · 2 comments

Comments

@longzb
Copy link

longzb commented Nov 20, 2016

比如store下面2个模块c和d,我想把请求都放在action里,为了方便以后复制粘贴,比如2个组件同是查询,都取名query,2个模块里的action都有个query方法,

我在组件里通过this.$store.dispatch('query')时,发现2个都调到了。
有什么办法指定调c或者d里的actions不?

@YamiOdymel
Copy link

YamiOdymel commented Nov 21, 2016

模塊僅有區分 States。Actions, Getters, Mutations 並沒有分模塊,你需要用命名空間(Namespace)。請參閱 #335

@fnlctrl
Copy link
Member

fnlctrl commented Nov 24, 2016

^ As above, thanks for the explanation @YamiOdymel

@fnlctrl fnlctrl closed this as completed Nov 24, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants