From 0b3146dba078e58a24e378c20efd3ccd70aa334e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=86=E7=A6=BB?= Date: Tue, 21 Jun 2016 18:50:07 +0800 Subject: [PATCH] modal destroy (#2124) * modal destroy * document and typo * remove blank line --- components/modal/confirm.jsx | 4 ++++ components/modal/demo/manual.md | 23 +++++++++++++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 components/modal/demo/manual.md 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); +````