UNPKG

qt-public-ui

Version:

新设计规范下业务组件库

81 lines (70 loc) 4.59 kB
## Modal 用法与[antd](https://ant.design/components/modal-cn/#API)相同 | 参数 | 说明 | 类型 | 默认值 | 版本 | | --- | --- | --- | --- | --- | | afterClose | Modal 完全关闭后的回调 | function | - | | | bodyStyle | Modal body 样式 | CSSProperties | | | | cancelButtonProps | cancel 按钮 props | [ButtonProps](https://ant.design/components/button-cn/#API) | - | | | cancelText | 取消按钮文字 | ReactNode | `取消` | | | centered | 垂直居中展示 Modal | boolean | false | | | closable | 是否显示右上角的关闭按钮 | boolean | true | | | closeIcon | 自定义关闭图标 | ReactNode | <CloseOutlined /> | | | confirmLoading | 确定按钮 loading | boolean | false | | | destroyOnClose | 关闭时销毁 Modal 里的子元素 | boolean | false | | | focusTriggerAfterClose | 对话框关闭后是否需要聚焦触发元素 | boolean | true | 4.9.0 | | footer | 底部内容,当不需要默认底部按钮时,可以设为 `footer={null}` | ReactNode | (确定取消按钮) | | | forceRender | 强制渲染 Modal | boolean | false | | | getContainer | 指定 Modal 挂载的 HTML 节点, false 为挂载在当前 dom | HTMLElement \| () => HTMLElement \| Selectors \| false | document.body | | | keyboard | 是否支持键盘 esc 关闭 | boolean | true | | | mask | 是否展示遮罩 | boolean | true | | | maskClosable | 点击蒙层是否允许关闭 | boolean | true | | | maskStyle | 遮罩样式 | CSSProperties | | | | modalRender | 自定义渲染对话框 | (node: ReactNode) => ReactNode | - | 4.7.0 | | okButtonProps | ok 按钮 props | [ButtonProps](https://ant.design/components/button-cn/#API) | - | | | okText | 确认按钮文字 | ReactNode | `确定` | | | okType | 确认按钮类型 | string | `primary` | | | style | 可用于设置浮层的样式,调整浮层位置等 | CSSProperties | - | | | title | 标题 | ReactNode | - | | | visible | 对话框是否可见 | boolean | - | | | width | 宽度 | string \| number | 520 | | | wrapClassName | 对话框外层容器的类名 | string | - | | | zIndex | 设置 Modal 的 `z-index` | number | 1000 | | | onCancel | 点击遮罩层或右上角叉或取消按钮的回调 | function(e) | - | | | onOk | 点击确定回调 | function(e) | - | | ## Modal.method() 注意:除了comfirm以外modal按钮的回调函数均为onCancel 用法与[antd](https://ant.design/components/modal-cn/#Modal.method())相同 包括: - `Modal.info` - `Modal.success` - `Modal.error` - `Modal.warning` - `Modal.confirm` 以上均为一个函数,参数为 object,具体属性如下: | 参数 | 说明 | 类型 | 默认值 | 版本 | | --- | --- | --- | --- | --- | | afterClose | Modal 完全关闭后的回调 | function | - | 4.9.0 | | autoFocusButton | 指定自动获得焦点的按钮 | null \| `ok` \| `cancel` | `ok` | | | bodyStyle | Modal body 样式 | CSSProperties | | 4.8.0 | | cancelButtonProps | cancel 按钮 props | [ButtonProps](https://ant.design/components/button-cn/#API) | - | | | cancelText | 设置 Modal.confirm 取消按钮文字 | string | `取消` | | | centered | 垂直居中展示 Modal | boolean | false | | | className | 容器类名 | string | - | | | closable | 是否显示右上角的关闭按钮 | boolean | false | 4.9.0 | | closeIcon | 自定义关闭图标 | ReactNode | undefined | 4.9.0 | | content | 内容 | ReactNode | - | | | getContainer | 指定 Modal 挂载的 HTML 节点, false 为挂载在当前 dom | HTMLElement \| () => HTMLElement \| Selectors \| false | document.body | | | icon | 自定义图标 | ReactNode | <QuestionCircle /> | 3.12.0 | | keyboard | 是否支持键盘 esc 关闭 | boolean | true | | | mask | 是否展示遮罩 | boolean | true | | | maskClosable | 点击蒙层是否允许关闭 | boolean | false | | | maskStyle | 遮罩样式 | object | {} | | | okButtonProps | ok 按钮 props | [ButtonProps](https://ant.design/components/button-cn/#API) | - | | | okText | 确认按钮文字 | string | `确定` | | | okType | 确认按钮类型 | string | `primary` | | | style | 可用于设置浮层的样式,调整浮层位置等 | CSSProperties | - | | | title | 标题 | ReactNode | - | | | width | 宽度 | string \| number | 416 | | | zIndex | 设置 Modal 的 `z-index` | number | 1000 | | | onCancel | 取消回调,参数为关闭函数,返回 promise 时 resolve 后自动关闭 | function(close) | - | | | onOk | 点击确定回调,参数为关闭函数,返回 promise 时 resolve 后自动关闭 | function(close) | - | |