2016-06-21 18:50:07 +08:00
|
|
|
---
|
|
|
|
order: 7
|
2016-11-15 15:02:30 +08:00
|
|
|
debug: true
|
|
|
|
title:
|
2016-08-11 11:41:06 +08:00
|
|
|
zh-CN: 手动移除
|
|
|
|
en-US: Manual to destroy
|
2016-06-21 18:50:07 +08:00
|
|
|
---
|
|
|
|
|
2016-08-11 11:41:06 +08:00
|
|
|
## zh-CN
|
|
|
|
|
2016-06-21 18:50:07 +08:00
|
|
|
手动关闭modal。
|
|
|
|
|
2016-08-11 11:41:06 +08:00
|
|
|
## en-US
|
|
|
|
|
|
|
|
Manually destroying a modal.
|
|
|
|
|
2017-01-19 15:19:03 +08:00
|
|
|
````__react
|
2016-06-21 18:50:07 +08:00
|
|
|
import { Modal, Button } from 'antd';
|
|
|
|
|
|
|
|
function success() {
|
|
|
|
const modal = Modal.success({
|
2016-08-11 11:41:06 +08:00
|
|
|
title: 'This is a notification message',
|
|
|
|
content: 'This modal will be destroyed after 1 second',
|
2016-06-21 18:50:07 +08:00
|
|
|
});
|
|
|
|
setTimeout(() => modal.destroy(), 1000);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
ReactDOM.render(<div>
|
2016-08-11 11:41:06 +08:00
|
|
|
<Button onClick={success}>Success</Button>
|
2016-06-21 18:50:07 +08:00
|
|
|
</div>, mountNode);
|
|
|
|
````
|