diff --git a/packages/fes-plugin-vuex/src/index.js b/packages/fes-plugin-vuex/src/index.js index d2b69cce..705edab1 100644 --- a/packages/fes-plugin-vuex/src/index.js +++ b/packages/fes-plugin-vuex/src/index.js @@ -54,7 +54,7 @@ export default (api) => { api.addPluginExports(() => [ { - specifiers: ['MUTATION_TYPES', 'ACTION_TYPES', 'GETTER_TYPES'], + specifiers: ['MUTATION_TYPES', 'ACTION_TYPES', 'GETTER_TYPES', 'store'], source: absCoreFilePath } ]); diff --git a/packages/fes-plugin-vuex/src/runtime/core.tpl b/packages/fes-plugin-vuex/src/runtime/core.tpl index 7366fc01..09a05e7f 100644 --- a/packages/fes-plugin-vuex/src/runtime/core.tpl +++ b/packages/fes-plugin-vuex/src/runtime/core.tpl @@ -8,18 +8,20 @@ const ACTION_TYPES = {{{ACTION_TYPES}}}; const GETTER_TYPES = {{{GETTER_TYPES}}}; const conifg = {{{VUEX_CONFIG}}}; +const store = createStore({ + modules: modules, + plugins: {{{PLUGINS}}}, + strict: conifg.strict, + devtools: conifg.devtools +}) const install = function (app) { - app.use(createStore({ - modules: modules, - plugins: {{{PLUGINS}}}, - strict: conifg.strict, - devtools: conifg.devtools - })); + app.use(store); } export { install, + store, MUTATION_TYPES, ACTION_TYPES, GETTER_TYPES diff --git a/packages/fes-template/src/app.js b/packages/fes-template/src/app.js index 5e380442..dfc169a2 100644 --- a/packages/fes-template/src/app.js +++ b/packages/fes-template/src/app.js @@ -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 UserCenter from '@/components/UserCenter'; +console.log(store.getters[GETTER_TYPES.user.address]); + export const beforeRender = { loading: , action() {