提交 fcb32972 编写于 作者: A afc163

Merge branch '0.8.0' of github.com:ant-design/ant-design into 0.8.0

......@@ -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'));
````
\ No newline at end of file
......@@ -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'));
````
\ No newline at end of file
......@@ -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,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'));
````
......@@ -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'));
````
\ No newline at end of file
......@@ -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>
......@@ -30,7 +30,6 @@ config 参数如下:
| key | 当前通知唯一标志 | String | 无 |
| onClose | 点击默认关闭按钮时触发的回调函数 | Function | 无 |
还提供了一个全局配置方法:
- `notification.config(options)`
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册