Browse Source

Merge pull request #111 from zhujun24/notification

Notification
pull/113/head
偏右 9 years ago
parent
commit
ce6b131b64
  1. 2
      components/notification/demo/basic.md
  2. 2
      components/notification/demo/onclose.md
  3. 2
      components/notification/demo/top.md
  4. 9
      components/notification/demo/with-btn-onclose.md
  5. 8
      components/notification/demo/with-btn.md
  6. 14
      components/notification/demo/with-icon.md
  7. 1
      components/notification/index.md

2
components/notification/demo/basic.md

@ -19,7 +19,7 @@ var openNotification = function() {
React.render(
<div>
<button className='ant-btn ant-btn-primary' onClick={openNotification}>基本</button>
<button className='ant-btn ant-btn-primary' onClick={openNotification}>打开通知提醒框</button>
</div>,
document.getElementById('components-notification-demo-basic'));
````

2
components/notification/demo/onclose.md

@ -24,7 +24,7 @@ var openNotification = function() {
React.render(
<div>
<button className='ant-btn ant-btn-primary' onClick={openNotification}>关闭按钮触发回调函数</button>
<button className='ant-btn ant-btn-primary' onClick={openNotification}>打开通知提醒框</button>
</div>,
document.getElementById('components-notification-demo-onclose'));
````

2
components/notification/demo/top.md

@ -21,6 +21,6 @@ var openNotification = function() {
};
React.render(
<button className='ant-btn ant-btn-primary' onClick={openNotification}>距离顶部100px</button>
<button className='ant-btn ant-btn-primary' onClick={openNotification}>打开通知提醒框</button>
, document.getElementById('components-notification-demo-top'));
````

9
components/notification/demo/with-btn-onclose.md

@ -9,11 +9,13 @@
````jsx
var notification = require('antd/lib/notification');
var key = 'someKeyString';
var close = function() {
// 自定义按钮关闭时的业务处理
console.log("我被自定义的关闭按钮关闭了!");
// 隐藏提醒框
notification.close('singleKey1');
notification.close(key);
};
var onClose = function() {
@ -24,18 +26,17 @@ var onClose = function() {
var btn = <button onClick={close} className="ant-btn ant-btn-primary ant-btn-sm">自定义关闭按钮并触发回调函数</button>;
var openNotification = function() {
var key = 'manual' + new Date().getTime();
var args = {
message: "这是标题",
description: "这是提示框的文案这是提示框示框的文案这是提示是提示框的文案这是提示框的文案",
btn: btn,
key: 'singleKey1',
key: key,
onClose: onClose
};
notification.open(args);
};
React.render(
<button className="ant-btn ant-btn-primary" onClick={openNotification}>点击自定义的按钮触发回调函数</button>
<button className="ant-btn ant-btn-primary" onClick={openNotification}>打开通知提醒框</button>
, document.getElementById('components-notification-demo-with-btn-onclose'));
````

8
components/notification/demo/with-btn.md

@ -9,8 +9,10 @@
````jsx
var notification = require('antd/lib/notification');
var key = 'someKeyStringString';
var close = function() {
notification.close('singleKey2');
notification.close(key);
};
var btn = <button onClick={close} className="ant-btn ant-btn-primary ant-btn-sm">自定义关闭按钮</button>;
@ -20,14 +22,14 @@ var openNotification = function() {
message: "这是标题",
description: "这是提示框的文案这是提示框示框的文案这是提示是提示框的文案这是提示框的文案",
btn: btn,
key: 'singleKey2'
key: key
};
notification.open(args);
};
React.render(
<div>
<button className="ant-btn ant-btn-primary" onClick={openNotification}>自定义关闭按钮</button>
<button className="ant-btn ant-btn-primary" onClick={openNotification}>打开通知提醒框</button>
</div>,
document.getElementById('components-notification-demo-with-btn'));
````

14
components/notification/demo/with-icon.md

@ -20,10 +20,16 @@ var openNotificationWithIcon = function(type) {
};
React.render(<div>
<button className="ant-btn ant-btn-primary" onClick={openNotificationWithIcon('success')}>Success</button>
<button className="ant-btn ant-btn-primary" onClick={openNotificationWithIcon('info')}>Info</button>
<button className="ant-btn ant-btn-primary" onClick={openNotificationWithIcon('warn')}>Warn</button>
<button className="ant-btn ant-btn-primary" onClick={openNotificationWithIcon('error')}>Error</button>
<button className="ant-btn" onClick={openNotificationWithIcon('success')}>成功</button>
<button className="ant-btn" onClick={openNotificationWithIcon('info')}>消息</button>
<button className="ant-btn" onClick={openNotificationWithIcon('warn')}>警告</button>
<button className="ant-btn" onClick={openNotificationWithIcon('error')}>错误</button>
</div>
, document.getElementById('components-notification-demo-with-icon'));
````
<style>
.code-box-demo .ant-btn {
margin-right: 1em;
}
</style>

1
components/notification/index.md

@ -30,7 +30,6 @@ config 参数如下:
| key | 当前通知唯一标志 | String | 无 |
| onClose | 点击默认关闭按钮时触发的回调函数 | Function | 无 |
还提供了一个全局配置方法:
- `notification.config(options)`

Loading…
Cancel
Save