You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

51 lines
848 B

---
order: 0
8 years ago
title:
zh-CN: 基本
en-US: Basic
---
10 years ago
8 years ago
## zh-CN
第一个对话框。
10 years ago
8 years ago
## en-US
Basic modal.
```jsx
import React, { useState } from 'react';
import { Modal, Button } from 'antd';
10 years ago
const App = () => {
const [isModalVisible, setIsModalVisible] = useState(false);
const showModal = () => {
setIsModalVisible(true);
};
const handleOk = () => {
setIsModalVisible(false);
};
const handleCancel = () => {
setIsModalVisible(false);
};
return (
<>
<Button type="primary" onClick={showModal}>
Open Modal
</Button>
<Modal title="Basic Modal" visible={isModalVisible} onOk={handleOk} onCancel={handleCancel}>
<p>Some contents...</p>
<p>Some contents...</p>
<p>Some contents...</p>
</Modal>
</>
);
};
10 years ago
ReactDOM.render(<App />, mountNode);
```