fix: store导出

This commit is contained in:
aringlai 2021-04-16 12:51:17 +08:00
parent 0fc21e0d10
commit 2242872c5c
3 changed files with 12 additions and 8 deletions

View File

@ -54,7 +54,7 @@ export default (api) => {
api.addPluginExports(() => [ api.addPluginExports(() => [
{ {
specifiers: ['MUTATION_TYPES', 'ACTION_TYPES', 'GETTER_TYPES'], specifiers: ['MUTATION_TYPES', 'ACTION_TYPES', 'GETTER_TYPES', 'store'],
source: absCoreFilePath source: absCoreFilePath
} }
]); ]);

View File

@ -8,18 +8,20 @@ const ACTION_TYPES = {{{ACTION_TYPES}}};
const GETTER_TYPES = {{{GETTER_TYPES}}}; const GETTER_TYPES = {{{GETTER_TYPES}}};
const conifg = {{{VUEX_CONFIG}}}; const conifg = {{{VUEX_CONFIG}}};
const store = createStore({
modules: modules,
plugins: {{{PLUGINS}}},
strict: conifg.strict,
devtools: conifg.devtools
})
const install = function (app) { const install = function (app) {
app.use(createStore({ app.use(store);
modules: modules,
plugins: {{{PLUGINS}}},
strict: conifg.strict,
devtools: conifg.devtools
}));
} }
export { export {
install, install,
store,
MUTATION_TYPES, MUTATION_TYPES,
ACTION_TYPES, ACTION_TYPES,
GETTER_TYPES GETTER_TYPES

View File

@ -1,9 +1,11 @@
import { access as accessApi } from '@fesjs/fes'; import { access as accessApi, store, GETTER_TYPES } from '@fesjs/fes';
import PageLoading from '@/components/PageLoading'; import PageLoading from '@/components/PageLoading';
import UserCenter from '@/components/UserCenter'; import UserCenter from '@/components/UserCenter';
console.log(store.getters[GETTER_TYPES.user.address]);
export const beforeRender = { export const beforeRender = {
loading: <PageLoading />, loading: <PageLoading />,
action() { action() {