This API is provided as an alpha preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
React 组件化弹出窗口接口
interface ISYS_ReactComponentizationDialogInterface 此接口提供了创建 React 组件化弹出窗口所需的所有功能。 通过此接口,用户可以使用 lc-editor-design 提供的预制组件创建自定义弹窗。
const { Components, WorkerPortal, VirtualRender } = await eda.sys_Dialog.createReactComponentizationDialogInterface(
{
createContext: React.createContext,
useContext: React.useContext,
useRef: React.useRef,
useEffect: React.useEffect,
createElement: React.createElement,
},
{
default: Reconciler,
constants: {
ContinuousEventPriority,
DiscreteEventPriority,
DefaultEventPriority,
ConcurrentRoot,
},
},
);
const portal = new WorkerPortal();
const root = new VirtualRender();
function MyDialog() {
return (
<Modal defaultTop={100} defaultLeft={100} defaultWidth={800} defaultHeight={600}>
<Dialog title="My Dialog">
<Input placeholder="Enter text" />
</Dialog>
</Modal>
);
}
root.render(
<portal.Provider>
<MyDialog />
</portal.Provider>,
);|
Property |
Modifiers |
Type |
Description |
|---|---|---|---|
|
(ALPHA) 预制组件 | |||
|
typeof LC_DESIGN_COMPONENTS_NAMES |
(ALPHA) 组件名称常量 | ||
|
(ALPHA) VirtualRender 类 | |||
|
(ALPHA) WorkerPortal 类 |
This API is provided as an alpha preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
预制组件
Components: LC_DESIGN_COMPONENTS;包含所有 lc-editor-design 提供的预制组件,如 Modal、Dialog、Input、Button 等。
This API is provided as an alpha preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
组件名称常量
LC_DESIGN_COMPONENTS_NAMES: typeof LC_DESIGN_COMPONENTS_NAMES;包含所有预制组件的名称常量,用于类型安全的组件引用。
This API is provided as an alpha preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
VirtualRender 类
VirtualRender: new () => ISYS_ReactComponentizationDialogVirtualRender;用于在虚拟环境中渲染 React 组件。 需要实例化后使用。
This API is provided as an alpha preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
WorkerPortal 类
WorkerPortal: new () => ISYS_ReactComponentizationDialogWorkerPortal;用于管理组件的生命周期和事件处理。 需要实例化后使用。