1.0.1 • Published 1 year ago

@yqg/react v1.0.1

Weekly downloads
-
License
ISC
Repository
-
Last release
1 year ago

antd based react components & hooks

Modal

ModalContext

PropertyDescriptionTypeDefault Value
commonDialogPropsdefault及ModalProvider上设置的Modal Props, 方便使用openModalObject{width: 768, maskClosable: false, footer: null, style: {overflowX: 'hidden', overflowY: 'auto'}}
open用来open没有被业务代码用Modal包裹的组件Function-
openModal用来open被业务代码用Modal包裹的组件Function-
clearAll路由跳转等情况下清空modalFunction-

ModalProvider

PropertyDescriptionTypeDefault Value
dialogPropsModal Props,详见antd ModalObject-
<ModalProvider dialogProps={xxx}>
    {children}
</ModalProvider>

useModal

Options 部分参数仅open支持, 因为openModal拿到的是ModalWrappedComp, 不方便定制Modal

PropertyDescriptionTypeDefault Value
dialogPropsModal Props,详见antd ModalObject-
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();
1.0.1

1 year ago

1.0.0

2 years ago