/* * @Author: yehuozhili * @Date: 2021-07-07 14:51:17 * @LastEditors: yehuozhili * @LastEditTime: 2022-01-13 13:22:40 * @FilePath: \dooringx\packages\dooringx-example\src\layouts\index.tsx */ import { Button } from 'antd'; import { UserConfig } from 'dooringx-lib'; import 'dooringx-lib/dist/dooringx-lib.esm.css'; import { createContext, useState } from 'react'; import { IRouteComponentProps } from 'umi'; import plugin from '../plugin'; import 'antd/dist/antd.css'; import '../global.less'; import 'animate.css'; import { IntlProvider } from 'react-intl'; import { locale } from 'dooringx-lib'; import { localeKey } from '../../../dooringx-lib/dist/locale'; export const config = new UserConfig(plugin); export const configContext = createContext(config); //config.i18n = false; // 自定义右键 const contextMenuState = config.getContextMenuState(); const unmountContextMenu = contextMenuState.unmountContextMenu; const commander = config.getCommanderRegister(); const ContextMenu = () => { const handleclick = () => { unmountContextMenu(); }; const forceUpdate = useState(0)[1]; contextMenuState.forceUpdate = () => { forceUpdate((pre) => pre + 1); }; return (
{ commander.exec('redo'); handleclick(); }} >
{ commander.exec('hide'); handleclick(); }} >
{ commander.exec('lock'); handleclick(); }} >
{ commander.exec('unlock'); handleclick(); }} >
); }; contextMenuState.contextMenu = ; interface LocaleContextType { change: Function; current: localeKey; } export const LocaleContext = createContext({ change: () => {}, current: 'zh-CN', }); export default function Layout({ children }: IRouteComponentProps) { const [l, setLocale] = useState('zh-CN'); return ( {children} ); return {children}; }