mirror of
https://github.com/ant-design/ant-design.git
synced 2024-12-11 23:00:20 +08:00
31 lines
688 B
TypeScript
31 lines
688 B
TypeScript
|
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;
|