Vuex gives you the flexibility to manage multiple store modules based on how you'd like to structure your project.
You can make the check to your firstModule's myArray within the fetchData action. That's the best practice. But, if you really need to access the rootState variable in a mutation, you have to pass it in as a variable reference, like you are currently.
I know how to use mapGetters in a single situation, but not both.
Example, I have firstRootGetter
inside store/index.js
, so I will call ...mapGetters(['firstRootGetter'])
in vue component.
If I have firstModuleGetter
and secondModuleGetter
inside store/modules/post.js
, I will call ...mapGetters('post', ['firstModuleGetter', 'secondModuleGetter'])
My question is, how do I call them in single ...mapGetters
. Is it possible?
Right now I have to write 2 lines to call them separately.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With