I recently transitioned my project from a single module in Vuex store to multiple modules as per the documentation.
The documentation explains how to access a specific module's state like this:
store.state.a // -> `moduleA`'s state
However, it fails to provide clear instructions on accessing getters, mutations, or commands like 'commit' and 'replaceState' for a specific module. Based on this, I made my own assumptions:
store.getters.a
store.mutations.a
store.a.commit()
store.a.replaceState()
1) Do you think these assumptions are correct?
2) When trying to use these methods, I encountered a vague error message:
TypeError: rawModule is undefined
Below is an excerpt from my store.js file:
import Vue from 'vue'
import Vuex from 'vuex'
Vue.use(Vuex)
export default new Vuex.Store({
modules: {
listingModule: listingModule,
openListingsOnDashModule: listingsOnDashModule,
closedListingsOnDashModule: listingsOnDashModule
}
})
const listingsOnDashModule = {...}
const listingModule = {...}
// Their content remains unchanged from the single module approach.