mirror of
https://github.com/ant-design/ant-design.git
synced 2025-01-18 14:13:37 +08:00
remove top.md add duration.md
This commit is contained in:
parent
b57f110e2d
commit
3c003cd00a
@ -1,26 +1,24 @@
|
||||
# 距离顶部距离
|
||||
# 自动关闭的延时
|
||||
|
||||
- order: 1
|
||||
|
||||
自定义通知框距离顶部的距离,在`config`方法里设置`top`的值, **只在初始化时设置有效** ,默认距离顶部`24px`。
|
||||
自定义通知框自动关闭的延时,默认`3s`,取消自动关闭只要将该值设为`0`即可。
|
||||
|
||||
---
|
||||
|
||||
````jsx
|
||||
var notification = require('antd/lib/notification');
|
||||
notification.config({
|
||||
top: 100
|
||||
});
|
||||
|
||||
var openNotification = function() {
|
||||
var args = {
|
||||
message: "这是标题",
|
||||
description: "这是提示框的文案这是提示框的文案这是提示框的文案这是提示框的文案这是提示框的文案这是提示框的文案这是提示框的文案",
|
||||
duration: 10
|
||||
};
|
||||
notification.open(args);
|
||||
};
|
||||
|
||||
React.render(
|
||||
<button className='ant-btn ant-btn-primary' onClick={openNotification}>打开通知提醒框</button>
|
||||
, document.getElementById('components-notification-demo-top'));
|
||||
, document.getElementById('components-notification-demo-duration'));
|
||||
````
|
@ -3,6 +3,7 @@ import assign from 'object-assign';
|
||||
import React from 'react';
|
||||
|
||||
let top = 24;
|
||||
let duration = 3;
|
||||
|
||||
var notificationInstance;
|
||||
|
||||
@ -46,7 +47,7 @@ function notice(args) {
|
||||
|
||||
<p className={prefixCls + 'description'}>{args.description}</p>
|
||||
</div>,
|
||||
duration: null,
|
||||
duration: isNaN(args.duration) ? duration : args.duration,
|
||||
closable: true,
|
||||
onClose: args.onClose,
|
||||
style: {}
|
||||
@ -60,7 +61,7 @@ function notice(args) {
|
||||
|
||||
<p className={prefixCls + 'description'}>{args.description}</p>
|
||||
</div>,
|
||||
duration: null,
|
||||
duration: isNaN(args.duration) ? duration : args.duration,
|
||||
closable: true,
|
||||
onClose: args.onClose,
|
||||
style: {}
|
||||
@ -75,7 +76,7 @@ function notice(args) {
|
||||
{args.btn}
|
||||
</span>
|
||||
</div>,
|
||||
duration: null,
|
||||
duration: isNaN(args.duration) ? duration : args.duration,
|
||||
closable: true,
|
||||
onClose: args.onClose,
|
||||
key: args.key,
|
||||
|
@ -26,6 +26,7 @@ config 参数如下:
|
||||
|----------- |--------------------------------------------- | ----------- |--------|
|
||||
| message | 通知提醒标题,必选 | React.Element or String | 无 |
|
||||
| description | 通知提醒内容,必选 | React.Element or String | 无 |
|
||||
| duration | 通知提醒自动关闭延时,值为`0`表示不自动关闭 | Number | 3 |
|
||||
| btn | 自定义关闭按钮 | React.Element | 无 |
|
||||
| key | 当前通知唯一标志 | String | 无 |
|
||||
| onClose | 点击默认关闭按钮时触发的回调函数 | Function | 无 |
|
||||
|
Loading…
Reference in New Issue
Block a user