diff --git a/components/modal/confirm.jsx b/components/modal/confirm.jsx index de72a817b9..7813f48c82 100644 --- a/components/modal/confirm.jsx +++ b/components/modal/confirm.jsx @@ -1,8 +1,10 @@ import React from 'react'; import Dialog from './index'; -let div; export default function (props) { + let div = document.createElement('div'); + document.body.appendChild(div); + let d; props = props || {}; props.iconClassName = props.iconClassName || 'anticon-question-circle'; @@ -17,6 +19,7 @@ export default function (props) { d.setState({ visible: false }); + React.unmountComponentAtNode(div); } function onCancel() { @@ -80,11 +83,6 @@ export default function (props) { ; } - if (!div) { - div = document.createElement('div'); - document.body.appendChild(div); - } - React.render(