mirror of
https://github.com/ant-design/ant-design.git
synced 2024-12-16 01:29:11 +08:00
39 lines
615 B
Markdown
39 lines
615 B
Markdown
---
|
|
order: 7
|
|
title:
|
|
zh-CN: 平滑地卸载
|
|
en-US: Smoothly Unmount
|
|
---
|
|
|
|
## zh-CN
|
|
|
|
平滑、自然的卸载提示。
|
|
|
|
## en-US
|
|
|
|
Smoothly unmount Alert upon close.
|
|
|
|
```tsx
|
|
import { Alert } from 'antd';
|
|
import React, { useState } from 'react';
|
|
|
|
const App: React.FC = () => {
|
|
const [visible, setVisible] = useState(true);
|
|
|
|
const handleClose = () => {
|
|
setVisible(false);
|
|
};
|
|
|
|
return (
|
|
<div>
|
|
{visible ? (
|
|
<Alert message="Alert Message Text" type="success" closable afterClose={handleClose} />
|
|
) : null}
|
|
<p>placeholder text here</p>
|
|
</div>
|
|
);
|
|
};
|
|
|
|
export default App;
|
|
```
|