actions.js 493 Bytes
Newer Older
1 2
// 主应用 和 子应用数据传递
import { initGlobalState } from 'qiankun';
邓晓峰's avatar
邓晓峰 committed
3
import { event, store } from '@wisdom-utils/utils';
4
export const initialState = {
邓晓峰's avatar
邓晓峰 committed
5 6 7
  globalConfig: {},
  event,
  store,
8 9 10 11 12
};

const actions = initGlobalState(initialState);
// action.setGlobalState({key: value}) 更新状态
// actions.onGlobalStateChange((newState, prevStaet) => {}) 监听状态
邓晓峰's avatar
邓晓峰 committed
13 14
export const { setGlobalState } = actions;
export const { onGlobalStateChange } = actions;
15
export default actions;