Merge pull request #52 from aringlai/vue3

Vue3
This commit is contained in:
harrywan 2021-04-16 14:13:27 +08:00 committed by GitHub
commit f2398d731b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 19 additions and 8 deletions

View File

@ -49,6 +49,13 @@ store.getters[GETTER_TYPES.user.address]
store.commit(MUTATION_TYPES.counter.increment)
store.dispatch(ACTION_TYPES.user.login)
```
```js
import { MUTATION_TYPES, GETTER_TYPES, ACTION_TYPES, store } from '@fesjs/fes';
store.getters[GETTER_TYPES.user.address]
store.commit(MUTATION_TYPES.counter.increment)
store.dispatch(ACTION_TYPES.user.login)
```
## API
### MUTATION_TYPES
* 类型 `Object`

View File

@ -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
}
]);

View File

@ -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

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 UserCenter from '@/components/UserCenter';
console.log(store.getters[GETTER_TYPES.user.address]);
export const beforeRender = {
loading: <PageLoading />,
action() {