| import React from 'react'; | |
| import { ExclamationCircleOutlined } from '@ant-design/icons'; | |
| import { Button, Modal } from 'antd'; | |
| const { confirm } = Modal; | |
| const destroyAll = () => { | |
| Modal.destroyAll(); | |
| }; | |
| const showConfirm = () => { | |
| for (let i = 0; i < 3; i += 1) { | |
| setTimeout(() => { | |
| confirm({ | |
| icon: <ExclamationCircleOutlined />, | |
| content: <Button onClick={destroyAll}>Click to destroy all</Button>, | |
| onOk() { | |
| console.log('OK'); | |
| }, | |
| onCancel() { | |
| console.log('Cancel'); | |
| }, | |
| }); | |
| }, i * 500); | |
| } | |
| }; | |
| const App: React.FC = () => <Button onClick={showConfirm}>Confirm</Button>; | |
| export default App; | |