Vuex namespace getters | vuex rootgetters
I’musingvuexnamespaceandcannotgetgetterstoworkacrossmodules.IpassgettersandrootGettersinthecorrectorder(copypastefromdocs)andtheyjustdonotseemtoworkthewaythedocssay.Ican’tgetthemtoworkatall…HowdoIdoitcorrectly?thisiswhatthedocssay:Module-foogetters:{//`getters`islocalizedtothismodulesgetters//youcanuserootGettersvia4thargumentofgetterssomeGetter(state,getters,rootState,rootGetters){getters.someOtherGetter//->foo/someOtherGetter**<-Howisthisdifferent**rootGetters.someOtherGetter//->s...
I’m using vuex namespace and cannot get getters to work across modules. I pass getters and rootGetters in the correct order (copy paste from docs) and they just do not seem to work the way the docs say. I can’t get them to work at all…
How do I do it correctly?
this is what the docs say:
Module-foo
getters: { // `getters` is localized to this modules getters // you can use rootGetters via 4th argument of getters someGetter (state, getters, rootState, rootGetters) { getters.someOtherGetter // -> foo/someOtherGetter **<- How is this different** rootGetters.someOtherGetter // -> someOtherGetter **<- from this?** }, someOtherGetter: state => { ... } },This is what I tried:
Module-A
state: { thing: thing }, getters: { getThing(state){ return state.thing; } }Module-B
getters: { getValueFromModuleA (state, getters, rootState, rootGetters) { getters.getThing; // -> undefined r...