vuex cannot get getters in modules - vuex
巴扎黑
巴扎黑 2017-05-19 10:20:27
0
2
725

I was using vuex when I started, and I found a very strange problem. It was not possible to use mapActions in modules, but when using mapGetters, an error was reported [vuex] unknown getter: user/USER_GETCOODE,
I felt very strange about this, so I added $ When the store printed it out, I found that my getters only had methods related to components, and there were no methods in modules, but _actions was normal.


getters method in modules


interface


vue calling method

巴扎黑
巴扎黑

reply all(2)
为情所困

Getters are written in modules, but they do not belong to modules, so when using getters, it is this.$store.getters.xxxx instead of locating under a module and then calling getters.

In addition, it is recommended that you install a Chrome plug-in for Vue Devtools, which will be more intuitive.

Inside the

module is getters, 不是 getter.

左手右手慢动作

Due to neglect, the getters of modules were written as getters. After modification, the method of modules can be obtained

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template