globalState.js 592 Bytes
// import store from '../store/index'
import { initGlobalState } from 'qiankun'
// 定义全局下发的数据
export const initialState = {
  // 当前登录用户
  userInfo: null,
  // 全局配置
  globalConfig: null,
  // 路由数据
  routers: null
}
const globalActions = initGlobalState(initialState)
globalActions.onGlobalStateChange((value, prev) => {
  console.log(`[主应用接收到值变化 - ${actions}]:`, value, prev)
})
export function setGlobalState(state) {
  globalActions.setGlobalState(state)
}
// 初始化全局下发的数据
export const actions = globalActions