2016-03-31 09:40:55 +08:00
|
|
|
---
|
|
|
|
order: 2
|
2016-08-17 11:07:02 +08:00
|
|
|
title:
|
|
|
|
zh-CN: 带有Icon的通知提醒框
|
|
|
|
en-US: A notification box with a icon
|
2016-03-31 09:40:55 +08:00
|
|
|
---
|
2015-07-28 15:40:28 +08:00
|
|
|
|
2016-08-17 11:07:02 +08:00
|
|
|
## zh-CN
|
|
|
|
|
2015-08-06 15:19:45 +08:00
|
|
|
通知提醒框左侧有图标。
|
2015-07-28 15:40:28 +08:00
|
|
|
|
2016-08-17 11:07:02 +08:00
|
|
|
## en-US
|
|
|
|
|
|
|
|
A notification box with a icon at the left side.
|
|
|
|
|
2015-07-28 15:40:28 +08:00
|
|
|
````jsx
|
2015-10-28 20:55:49 +08:00
|
|
|
import { Button, notification } from 'antd';
|
2015-07-28 15:40:28 +08:00
|
|
|
|
2016-01-27 16:53:05 +08:00
|
|
|
const openNotificationWithIcon = function (type) {
|
|
|
|
return function () {
|
2015-08-06 15:19:45 +08:00
|
|
|
notification[type]({
|
2016-08-17 11:07:02 +08:00
|
|
|
message: 'This is the title',
|
|
|
|
description: 'This is the content of the notification.This is the content of the notification.This is the content of the notification.',
|
2015-08-06 15:19:45 +08:00
|
|
|
});
|
2015-08-04 15:16:10 +08:00
|
|
|
};
|
2015-08-03 15:17:12 +08:00
|
|
|
};
|
|
|
|
|
2016-01-07 16:29:12 +08:00
|
|
|
ReactDOM.render(
|
|
|
|
<div>
|
2016-08-17 11:07:02 +08:00
|
|
|
<Button onClick={openNotificationWithIcon('success')}>Success</Button>
|
|
|
|
<Button onClick={openNotificationWithIcon('info')}>Info</Button>
|
|
|
|
<Button onClick={openNotificationWithIcon('warning')}>Warning</Button>
|
|
|
|
<Button onClick={openNotificationWithIcon('error')}>Error</Button>
|
2015-08-03 15:17:12 +08:00
|
|
|
</div>
|
2015-12-29 12:08:58 +08:00
|
|
|
, mountNode);
|
2015-08-04 15:48:00 +08:00
|
|
|
````
|
|
|
|
|
|
|
|
<style>
|
|
|
|
.code-box-demo .ant-btn {
|
|
|
|
margin-right: 1em;
|
|
|
|
}
|
|
|
|
</style>
|