mirror of
https://github.com/ant-design/ant-design.git
synced 2024-12-25 16:58:00 +08:00
43 lines
916 B
TypeScript
43 lines
916 B
TypeScript
|
import React, { useState } from 'react';
|
||
|
import { Button, Modal } from 'antd';
|
||
|
|
||
|
const App: React.FC = () => {
|
||
|
const [open, setOpen] = useState(false);
|
||
|
|
||
|
const showModal = () => {
|
||
|
setOpen(true);
|
||
|
};
|
||
|
|
||
|
const handleOk = (e: React.MouseEvent<HTMLElement>) => {
|
||
|
console.log(e);
|
||
|
setOpen(false);
|
||
|
};
|
||
|
|
||
|
const handleCancel = (e: React.MouseEvent<HTMLElement>) => {
|
||
|
console.log(e);
|
||
|
setOpen(false);
|
||
|
};
|
||
|
|
||
|
return (
|
||
|
<>
|
||
|
<Button type="primary" onClick={showModal}>
|
||
|
Open Modal with customized button props
|
||
|
</Button>
|
||
|
<Modal
|
||
|
title="Basic Modal"
|
||
|
open={open}
|
||
|
onOk={handleOk}
|
||
|
onCancel={handleCancel}
|
||
|
okButtonProps={{ disabled: true }}
|
||
|
cancelButtonProps={{ disabled: true }}
|
||
|
>
|
||
|
<p>Some contents...</p>
|
||
|
<p>Some contents...</p>
|
||
|
<p>Some contents...</p>
|
||
|
</Modal>
|
||
|
</>
|
||
|
);
|
||
|
};
|
||
|
|
||
|
export default App;
|