2016-08-03 14:54:10 +08:00
|
|
|
---
|
|
|
|
order: 6
|
2017-04-22 10:37:00 +08:00
|
|
|
iframe: 250
|
2016-08-03 14:54:10 +08:00
|
|
|
title:
|
|
|
|
zh-CN: 顶部公告
|
|
|
|
en-US: Banner
|
|
|
|
---
|
|
|
|
|
|
|
|
## zh-CN
|
|
|
|
|
2020-03-30 18:44:49 +08:00
|
|
|
页面顶部通告形式,默认有图标且 `type` 为 'warning'。
|
2016-08-03 14:54:10 +08:00
|
|
|
|
|
|
|
## en-US
|
|
|
|
|
2017-03-22 17:32:52 +08:00
|
|
|
Display Alert as a banner at top of page.
|
2016-08-03 14:54:10 +08:00
|
|
|
|
2020-01-21 16:21:37 +08:00
|
|
|
```tsx
|
2016-08-03 14:54:10 +08:00
|
|
|
import { Alert } from 'antd';
|
2022-05-23 14:37:16 +08:00
|
|
|
import React from 'react';
|
2016-08-03 14:54:10 +08:00
|
|
|
|
2022-05-19 09:46:26 +08:00
|
|
|
const App: React.FC = () => (
|
2020-03-30 18:44:49 +08:00
|
|
|
<>
|
2016-08-03 14:54:10 +08:00
|
|
|
<Alert message="Warning text" banner />
|
|
|
|
<br />
|
2019-05-07 14:57:32 +08:00
|
|
|
<Alert
|
|
|
|
message="Very long warning text warning text text text text text text text"
|
|
|
|
banner
|
|
|
|
closable
|
|
|
|
/>
|
2017-04-22 10:37:00 +08:00
|
|
|
<br />
|
|
|
|
<Alert showIcon={false} message="Warning text without icon" banner />
|
|
|
|
<br />
|
|
|
|
<Alert type="error" message="Error text" banner />
|
2022-04-03 23:27:45 +08:00
|
|
|
</>
|
2018-11-28 15:00:03 +08:00
|
|
|
);
|
2022-05-19 09:46:26 +08:00
|
|
|
|
|
|
|
export default App;
|
2019-05-07 14:57:32 +08:00
|
|
|
```
|