2016-03-31 09:40:55 +08:00
|
|
|
---
|
|
|
|
order: 0
|
2016-09-14 14:49:12 +08:00
|
|
|
title:
|
2016-08-11 11:41:06 +08:00
|
|
|
zh-CN: 基本
|
|
|
|
en-US: Basic
|
2016-03-31 09:40:55 +08:00
|
|
|
---
|
2015-06-04 21:17:52 +08:00
|
|
|
|
2016-09-14 14:49:12 +08:00
|
|
|
## zh-CN
|
2016-08-11 11:41:06 +08:00
|
|
|
|
2015-06-12 17:44:29 +08:00
|
|
|
第一个对话框。
|
2015-06-04 21:17:52 +08:00
|
|
|
|
2016-09-14 14:49:12 +08:00
|
|
|
## en-US
|
2016-08-11 11:41:06 +08:00
|
|
|
|
2017-05-16 10:43:12 +08:00
|
|
|
Basic modal.
|
2016-08-11 11:41:06 +08:00
|
|
|
|
2022-05-19 09:46:26 +08:00
|
|
|
```tsx
|
2022-05-23 14:37:16 +08:00
|
|
|
import { Button, Modal } from 'antd';
|
2020-11-30 14:04:26 +08:00
|
|
|
import React, { useState } from 'react';
|
2015-06-04 21:17:52 +08:00
|
|
|
|
2022-05-19 09:46:26 +08:00
|
|
|
const App: React.FC = () => {
|
2020-11-30 14:04:26 +08:00
|
|
|
const [isModalVisible, setIsModalVisible] = useState(false);
|
2018-06-27 15:55:04 +08:00
|
|
|
|
2020-11-30 14:04:26 +08:00
|
|
|
const showModal = () => {
|
|
|
|
setIsModalVisible(true);
|
2019-05-07 14:57:32 +08:00
|
|
|
};
|
2018-06-27 15:55:04 +08:00
|
|
|
|
2020-11-30 14:04:26 +08:00
|
|
|
const handleOk = () => {
|
|
|
|
setIsModalVisible(false);
|
2019-05-07 14:57:32 +08:00
|
|
|
};
|
2018-06-27 15:55:04 +08:00
|
|
|
|
2020-11-30 14:04:26 +08:00
|
|
|
const handleCancel = () => {
|
|
|
|
setIsModalVisible(false);
|
2019-05-07 14:57:32 +08:00
|
|
|
};
|
2018-06-27 15:55:04 +08:00
|
|
|
|
2020-11-30 14:04:26 +08:00
|
|
|
return (
|
|
|
|
<>
|
|
|
|
<Button type="primary" onClick={showModal}>
|
|
|
|
Open Modal
|
|
|
|
</Button>
|
2020-12-09 17:12:32 +08:00
|
|
|
<Modal title="Basic Modal" visible={isModalVisible} onOk={handleOk} onCancel={handleCancel}>
|
2020-11-30 14:04:26 +08:00
|
|
|
<p>Some contents...</p>
|
|
|
|
<p>Some contents...</p>
|
|
|
|
<p>Some contents...</p>
|
|
|
|
</Modal>
|
|
|
|
</>
|
|
|
|
);
|
2020-12-09 17:12:32 +08:00
|
|
|
};
|
2015-06-04 21:17:52 +08:00
|
|
|
|
2022-04-15 16:20:56 +08:00
|
|
|
export default App;
|
2019-05-07 14:57:32 +08:00
|
|
|
```
|