mirror of
https://github.com/ant-design/ant-design.git
synced 2024-12-29 03:48:26 +08:00
43 lines
968 B
Markdown
43 lines
968 B
Markdown
---
|
|
order: 2
|
|
title:
|
|
zh-CN: 带有Icon的通知提醒框
|
|
en-US: A notification box with a icon
|
|
---
|
|
|
|
## zh-CN
|
|
|
|
通知提醒框左侧有图标。
|
|
|
|
## en-US
|
|
|
|
A notification box with a icon at the left side.
|
|
|
|
````jsx
|
|
import { Button, notification } from 'antd';
|
|
|
|
const openNotificationWithIcon = function (type) {
|
|
return function () {
|
|
notification[type]({
|
|
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.',
|
|
});
|
|
};
|
|
};
|
|
|
|
ReactDOM.render(
|
|
<div>
|
|
<Button onClick={openNotificationWithIcon('success')}>Success</Button>
|
|
<Button onClick={openNotificationWithIcon('info')}>Info</Button>
|
|
<Button onClick={openNotificationWithIcon('warning')}>Warning</Button>
|
|
<Button onClick={openNotificationWithIcon('error')}>Error</Button>
|
|
</div>
|
|
, mountNode);
|
|
````
|
|
|
|
<style>
|
|
.code-box-demo .ant-btn {
|
|
margin-right: 1em;
|
|
}
|
|
</style>
|