静态调用意味着调用可以用在任何地方,例如工具脚本,store 中,甚至能配合动态导入使用
其中demos/MyAsyncModal
内容为
1import React, { ReactNode } from 'react';
2import { Modal } from '@douyinfe/semi-ui';
3import { OpenableProps, openify } from 'openify';
4
5type MyAsyncModalProps = OpenableProps<void> & {
6 content: ReactNode;
7};
8
9const MyAsyncModal = ({
10 visible,
11 content,
12 onClose,
13 afterClose,
14}: MyAsyncModalProps) => {
15 return (
16 <Modal
17 title="动态加载弹窗"
18 visible={visible}
19 onOk={onClose}
20 onCancel={onClose}
21 afterClose={afterClose}
22 >
23 {content}
24 </Modal>
25 );
26};
27
28export const openMyAsyncModal = openify(MyAsyncModal);
29
30export default MyAsyncModal;