mirror of
https://github.com/ant-design/ant-design.git
synced 2024-12-22 22:48:29 +08:00
093c6c2d1f
Some checks are pending
Publish Any Commit / build (push) Waiting to run
🔀 Sync mirror to Gitee / mirror (push) Waiting to run
✅ test / lint (push) Waiting to run
✅ test / test-react-legacy (16, 1/2) (push) Waiting to run
✅ test / test-react-legacy (16, 2/2) (push) Waiting to run
✅ test / test-react-legacy (17, 1/2) (push) Waiting to run
✅ test / test-react-legacy (17, 2/2) (push) Waiting to run
✅ test / test-node (push) Waiting to run
✅ test / test-react-latest (dom, 1/2) (push) Waiting to run
✅ test / test-react-latest (dom, 2/2) (push) Waiting to run
✅ test / test-react-latest-dist (dist, 1/2) (push) Blocked by required conditions
✅ test / test-react-latest-dist (dist, 2/2) (push) Blocked by required conditions
✅ test / test-react-latest-dist (dist-min, 1/2) (push) Blocked by required conditions
✅ test / test-react-latest-dist (dist-min, 2/2) (push) Blocked by required conditions
✅ test / test-coverage (push) Blocked by required conditions
✅ test / build (push) Waiting to run
✅ test / test lib/es module (es, 1/2) (push) Waiting to run
✅ test / test lib/es module (es, 2/2) (push) Waiting to run
✅ test / test lib/es module (lib, 1/2) (push) Waiting to run
✅ test / test lib/es module (lib, 2/2) (push) Waiting to run
👁️ Visual Regression Persist Start / test image (push) Waiting to run
64 lines
1.4 KiB
TypeScript
64 lines
1.4 KiB
TypeScript
import React, { useState } from 'react';
|
|
import { Button, Modal } from 'antd';
|
|
|
|
const App: React.FC = () => {
|
|
const [loading, setLoading] = useState(false);
|
|
const [open, setOpen] = useState(false);
|
|
|
|
const showModal = () => {
|
|
setOpen(true);
|
|
};
|
|
|
|
const handleOk = () => {
|
|
setLoading(true);
|
|
setTimeout(() => {
|
|
setLoading(false);
|
|
setOpen(false);
|
|
}, 3000);
|
|
};
|
|
|
|
const handleCancel = () => {
|
|
setOpen(false);
|
|
};
|
|
|
|
return (
|
|
<>
|
|
<Button type="primary" onClick={showModal}>
|
|
Open Modal with customized footer
|
|
</Button>
|
|
<Modal
|
|
open={open}
|
|
title="Title"
|
|
onOk={handleOk}
|
|
onCancel={handleCancel}
|
|
footer={[
|
|
<Button key="back" onClick={handleCancel}>
|
|
Return
|
|
</Button>,
|
|
<Button key="submit" type="primary" loading={loading} onClick={handleOk}>
|
|
Submit
|
|
</Button>,
|
|
<Button
|
|
key="link"
|
|
href="https://google.com"
|
|
target="_blank"
|
|
type="primary"
|
|
loading={loading}
|
|
onClick={handleOk}
|
|
>
|
|
Search on Google
|
|
</Button>,
|
|
]}
|
|
>
|
|
<p>Some contents...</p>
|
|
<p>Some contents...</p>
|
|
<p>Some contents...</p>
|
|
<p>Some contents...</p>
|
|
<p>Some contents...</p>
|
|
</Modal>
|
|
</>
|
|
);
|
|
};
|
|
|
|
export default App;
|