mirror of
https://github.com/ant-design/ant-design.git
synced 2024-12-30 20:38:45 +08:00
7cdeecfe1e
* feat: Modal support loading * feat: Modal support loading * chore: update skeleton className * fix: fix * demo: add LoadingOutlined * fix: revert icon * fix: fix * fix: renderFooter * fix: renderFooter * demo: update demo * demo: update demo * demo: update demo * chore: clear * Update loading.tsx Signed-off-by: 二货爱吃白萝卜 <smith3816@gmail.com> * fix: fix --------- Signed-off-by: 二货爱吃白萝卜 <smith3816@gmail.com> Co-authored-by: 二货爱吃白萝卜 <smith3816@gmail.com>
43 lines
949 B
TypeScript
43 lines
949 B
TypeScript
import React from 'react';
|
|
import { Button, Modal } from 'antd';
|
|
|
|
const App: React.FC = () => {
|
|
const [open, setOpen] = React.useState<boolean>(false);
|
|
const [loading, setLoading] = React.useState<boolean>(true);
|
|
|
|
const showLoading = () => {
|
|
setOpen(true);
|
|
setLoading(true);
|
|
|
|
// Simple loading mock. You should add cleanup logic in real world.
|
|
setTimeout(() => {
|
|
setLoading(false);
|
|
}, 2000);
|
|
};
|
|
|
|
return (
|
|
<>
|
|
<Button type="primary" onClick={showLoading}>
|
|
Open Modal
|
|
</Button>
|
|
<Modal
|
|
title={<p>Loading Modal</p>}
|
|
footer={
|
|
<Button type="primary" onClick={showLoading}>
|
|
Reload
|
|
</Button>
|
|
}
|
|
loading={loading}
|
|
open={open}
|
|
onCancel={() => setOpen(false)}
|
|
>
|
|
<p>Some contents...</p>
|
|
<p>Some contents...</p>
|
|
<p>Some contents...</p>
|
|
</Modal>
|
|
</>
|
|
);
|
|
};
|
|
|
|
export default App;
|