2015-07-29 20:08:16 +08:00
|
|
|
# 自定义关闭按钮
|
2015-07-28 15:40:28 +08:00
|
|
|
|
2015-07-29 20:08:16 +08:00
|
|
|
- order: 3
|
2015-07-28 15:40:28 +08:00
|
|
|
|
2015-07-29 20:08:16 +08:00
|
|
|
自定义关闭按钮的样式和文字。
|
2015-07-28 15:40:28 +08:00
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
````jsx
|
|
|
|
var Notification = require('antd/lib/notification');
|
|
|
|
|
|
|
|
if(!Notification.notification){
|
|
|
|
Notification.notification = Notification.newInstance({
|
|
|
|
prefixCls: 'ant-notification',
|
|
|
|
style: {
|
|
|
|
top: 0,
|
|
|
|
right: 0
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2015-07-29 20:08:16 +08:00
|
|
|
var btn = <button className="ant-btn ant-btn-primary ant-btn-sm">自定义关闭按钮</button>;
|
2015-07-28 15:40:28 +08:00
|
|
|
|
2015-07-29 20:08:16 +08:00
|
|
|
var openNotification = function() {
|
2015-07-28 15:40:28 +08:00
|
|
|
var args = {
|
2015-07-29 20:08:16 +08:00
|
|
|
message: "这是标题",
|
|
|
|
description: "这是提示框的文案这是提示框示框的文案这是提示是提示框的文案这是提示框的文案",
|
|
|
|
btn: btn
|
2015-07-28 15:40:28 +08:00
|
|
|
};
|
|
|
|
Notification.show(args);
|
|
|
|
}
|
|
|
|
|
|
|
|
React.render(
|
|
|
|
<div>
|
2015-07-29 20:08:16 +08:00
|
|
|
<button className="ant-btn ant-btn-primary" onClick={openNotification}>自定义关闭按钮</button>
|
|
|
|
</div>,
|
|
|
|
document.getElementById('components-notification-demo-with-btn'));
|
2015-07-28 15:40:28 +08:00
|
|
|
````
|