I have the following module:
export const ProfileData = {
state: {
ajaxData: null;
},
getters: {/*getters here*/},
mutations: {/*mutations here*/},
actions: {/*actions here*/}
}
and this module is registered in my global store:
import {ProfileData} from './store/modules/ProfileData.es6'
const store = new Vuex.Store({
modules: {
ProfileData: ProfileData
}
});
I have also used the Vue.use(Vuex)
and set the store in new Vue({ store: store})
properly. However, when I try to access the ajaxData
belonging to the ProfileData
module, in one of my components via this.$store.ProfileData.ajaxData
, the console shows an undefined
error. The same goes for reading the this.$store.ProfileData
or this.$store.ajaxData
, while this.$store
is defined and I am already able to read it. I also see the ProfileData
object added to the _modules
property of the store in browser's console.
What is that I am doing wrong to access the modules registered to the Vuex
? How can I access those?
state
property I am able to get theajaxData
now. But, how about accessing the getters, mutations, etc). An example would be very much appreciated :) – Irfan