diff --git a/components/modal/confirm.jsx b/components/modal/confirm.jsx index f37d4d35fb..62f292b468 100644 --- a/components/modal/confirm.jsx +++ b/components/modal/confirm.jsx @@ -129,4 +129,8 @@ export default function confirm(config) { , div, function () { d = this; }); + + return { + destroy: close, + }; } diff --git a/components/modal/demo/manual.md b/components/modal/demo/manual.md new file mode 100644 index 0000000000..db8521a33d --- /dev/null +++ b/components/modal/demo/manual.md @@ -0,0 +1,23 @@ +--- +order: 7 +title: 手动移除 +--- + +手动关闭modal。 + +````jsx +import { Modal, Button } from 'antd'; + +function success() { + const modal = Modal.success({ + title: '这是一条通知信息', + content: '一秒后自动移除', + }); + setTimeout(() => modal.destroy(), 1000); +} + + +ReactDOM.render(
+ +
, mountNode); +````