Commit ff24bf0f965c817f1197fe53f6ee70b74c2288eb

Authored by 田强
1 parent d438a543

refactor: ConfigProvider

Showing 2 changed files with 25 additions and 6 deletions
src/app.ts deleted 100644 → 0
1 -/**  
2 - * @see https://umijs.org/zh-CN/plugins/plugin-initial-state  
3 - * */  
4 -export async function getInitialState(): Promise<{}> {  
5 - return window.qx.getModuleData();  
6 -}  
  1 +import { ConfigProvider } from 'antd';
  2 +import { ReactNode } from 'react';
  3 +import pkg from '../package.json';
  4 +
  5 +const { name } = pkg;
  6 +
  7 +/**
  8 + * @see https://v3.umijs.org/zh-CN/plugins/plugin-initial-state#getinitialstate
  9 + * */
  10 +export async function getInitialState(): Promise<{}> {
  11 + return window.qx.getModuleData();
  12 +}
  13 +
  14 +/**
  15 + * @see https://v3.umijs.org/zh-CN/docs/runtime-config#rootcontainerlastrootcontainer-args
  16 + */
  17 +export function rootContainer(container: ReactNode) {
  18 + return (
  19 + <ConfigProvider
  20 + getPopupContainer={() => document.getElementById(name) || document.body}
  21 + >
  22 + {container}
  23 + </ConfigProvider>
  24 + );
  25 +}