mirror of
https://github.com/WeBankFinTech/fes.js.git
synced 2025-04-06 03:59:53 +08:00
commit
f2398d731b
@ -49,6 +49,13 @@ store.getters[GETTER_TYPES.user.address]
|
|||||||
store.commit(MUTATION_TYPES.counter.increment)
|
store.commit(MUTATION_TYPES.counter.increment)
|
||||||
store.dispatch(ACTION_TYPES.user.login)
|
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
|
## API
|
||||||
### MUTATION_TYPES
|
### MUTATION_TYPES
|
||||||
* 类型 `Object`
|
* 类型 `Object`
|
||||||
|
@ -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
|
||||||
}
|
}
|
||||||
]);
|
]);
|
||||||
|
@ -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({
|
||||||
const install = function (app) {
|
|
||||||
app.use(createStore({
|
|
||||||
modules: modules,
|
modules: modules,
|
||||||
plugins: {{{PLUGINS}}},
|
plugins: {{{PLUGINS}}},
|
||||||
strict: conifg.strict,
|
strict: conifg.strict,
|
||||||
devtools: conifg.devtools
|
devtools: conifg.devtools
|
||||||
}));
|
})
|
||||||
|
|
||||||
|
const install = function (app) {
|
||||||
|
app.use(store);
|
||||||
}
|
}
|
||||||
|
|
||||||
export {
|
export {
|
||||||
install,
|
install,
|
||||||
|
store,
|
||||||
MUTATION_TYPES,
|
MUTATION_TYPES,
|
||||||
ACTION_TYPES,
|
ACTION_TYPES,
|
||||||
GETTER_TYPES
|
GETTER_TYPES
|
||||||
|
@ -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() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user