Add getContainer for message and notification, close #5019 (#5066)

This commit is contained in:
偏右 2017-02-27 13:39:37 +08:00 committed by GitHub
parent 7fd08efbb7
commit c552b315bc
7 changed files with 7 additions and 2 deletions

View File

@ -27,6 +27,7 @@ This components provides 4 static methods, with arguments as following:
|------------|------------------------------------|--------------------------|--------------|
| content | content of the message | string\|ReactNode | - |
| duration | time before auto-dismiss,in seconds | number | 1.5 |
| getContainer | specify render container | () => HTMLElement | () => document.body |
Methods for global configuration and destruction are also provided:

View File

@ -61,6 +61,7 @@ export interface ConfigOptions {
top?: number;
duration?: number;
prefixCls?: string;
getContainer?: () => HTMLElement;
}
export default {

View File

@ -28,6 +28,7 @@ title: Message
|------------|----------------|--------------------------|--------------|
| content | 提示内容 | string\|ReactNode | - |
| duration | 自动关闭的延时,单位秒 | number | 1.5 |
| getContainer | 配置渲染节点的输出位置 | () => HTMLElement | () => document.body |
还提供了全局配置和全局销毁方法:

View File

@ -38,7 +38,7 @@ The properties of config are as follows:
| onClose | Specify a function that will be called after clicking the default close button | Function | - |
| duration | A notification box is closed after 4.5s by default. When specifying `duration` to null or 0, it will never be closed automatically | number | 4.5 |
| placement | To set the position, which can be one of `topLeft` `topRight` `bottomLeft` `bottomRight` | string | topRight |
| getContainer | specify render container | () => HTMLNode | () => document.body |
`notification` also provide a global `config()` method that can be used for specifying the default options. Once this method is used, all the notification boxes
will take into account these globally defined options before displaying.

View File

@ -53,6 +53,7 @@ export interface ArgsProps {
duration?: number;
icon?: React.ReactNode;
placement?: notificationPlacement;
getContainer?: () => HTMLElement;
}
export interface ConfigProps {

View File

@ -38,6 +38,7 @@ config 参数如下:
| onClose | 点击默认关闭按钮时触发的回调函数 | Function | - |
| duration | 默认 4.5 秒后自动关闭,配置为 null 则不自动关闭 | number | 4.5 |
| placement | 弹出位置,可选 `topLeft` `topRight` `bottomLeft` `bottomRight` | string | topRight |
| getContainer | 配置渲染节点的输出位置 | () => HTMLNode | () => document.body |
还提供了一个全局配置方法,在调用前提前配置,全局一次生效。

View File

@ -52,7 +52,7 @@
"rc-form": "~1.3.0",
"rc-input-number": "~3.1.1",
"rc-menu": "~5.0.9",
"rc-notification": "~1.3.4",
"rc-notification": "~1.4.0",
"rc-pagination": "~1.7.0",
"rc-progress": "~2.0.1",
"rc-radio": "~2.0.0",