Package Exports
- @uiw/react-portal
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@uiw/react-portal) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Portal 入口
Portals
是 react 16 提供的官方解决方案,使得组件可以脱离父组件层级挂载在 DOM 树的任何位置,我们利用这个方法,可将模态对话框生成到根节点的外面。
import { Portal } from 'uiw';
基本使用
import { Portal } from 'uiw';
const Demo = () => {
return (
<Portal className="name">
容器内显示内容
</Portal>
)
}
Props
参数 | 说明 | 类型 | 默认值 |
---|---|---|---|
className | 指定样式名 | string | - |
container | 指定容器节点生成,服务端渲染默认为 null |
any | document.body |
onChildrenMount | 渲染后的回调函数 | () => void | - |