@yqg/react
v1.0.1
Published
react based components
Downloads
2
Readme
antd based react components & hooks
Modal
ModalContext
|Property|Description|Type|Default Value| |---|---|---|---| |commonDialogProps|default及ModalProvider上设置的Modal Props, 方便使用openModal|Object|{width: 768, maskClosable: false, footer: null, style: {overflowX: 'hidden', overflowY: 'auto'}}| |open|用来open没有被业务代码用Modal包裹的组件|Function|-| |openModal|用来open被业务代码用Modal包裹的组件|Function|-| |clearAll|路由跳转等情况下清空modal|Function|-|
ModalProvider
|Property|Description|Type|Default Value| |---|---|---|---| |dialogProps|Modal Props,详见antd Modal|Object|-|
<ModalProvider dialogProps={xxx}>
{children}
</ModalProvider>
useModal
Options 部分参数仅open支持, 因为openModal拿到的是ModalWrappedComp, 不方便定制Modal
|Property|Description|Type|Default Value| |---|---|---|---| |dialogProps|Modal Props,详见antd Modal|Object|-| |onlyClose|只展示关闭按钮, 目前仅open支持|boolean|-| |closeText|关闭按钮文案, 目前仅open支持|ReactNode|关闭|
const {commonDialogProps, open, openModal, clearAll} = useModal();
open(CompA, compProps, options).then(xxx);
openModal(ModalWrappedB, compProps, options).then(xxx);
clearAll();