# ExportVuexStore
Every class you decorate with @VuexClass
is saved internally inside a stores
object. So if you want to access the store you created just pass the class to the ExportVuexStore
method, which returns the final object, even with all the nested modules, ready to be passed to vuex.
// ./TestStore.js
import { VuexClass, VuexModule } from '@averjs/vuex-decorators';
@VuexClass
export default class TestStore extends VuexModule {
moduleName = 'test';
test = 'test';
}
import Vuex from 'vuex';
import { config, ExportVuexStore } from '@averjs/vuex-decorators';
import TestStore from './TestStore.js';
ExportVuexStore(TestStore);
this would produce
{
namespaced: true,
moduleName: 'test',
nested: [],
state: () => {
return {
test: 'test'
};
},
getters: {},
actions: {},
mutations: {},
modules: {},
persistent: false
}
There is also a second parameter exportAsReadyObject
which returns the same object, already keyed with the moduleName.
ExportVuexStore(TestStore, true);
{
test: {
namespaced: true,
moduleName: 'test',
nested: [],
state: () => {
return {
test: 'test'
};
},
getters: {},
actions: {},
mutations: {},
modules: {},
persistent: false
}
}
← VuexModule Config →