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
为情所困2017-05-19 10:22:27
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 themodule is getters
, 不是 getter
.
ringa_lee2017-05-19 10:22:27
Due to neglect, the getters of modules were written as getters. After modification, the method of modules can be obtained