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.

59 lines
956 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 { Modal, Button } from 'antd';
10 years ago
class App extends React.Component {
state = { visible: false }
showModal = () => {
10 years ago
this.setState({
visible: true,
10 years ago
});
}
handleOk = (e) => {
console.log(e);
10 years ago
this.setState({
visible: false,
10 years ago
});
}
handleCancel = (e) => {
console.log(e);
this.setState({
visible: false,
});
}
render() {
return (
<div>
<Button type="primary" onClick={this.showModal}>Open</Button>
<Modal
title="Basic Modal"
visible={this.state.visible}
onOk={this.handleOk}
onCancel={this.handleCancel}
>
<p>Some contents...</p>
<p>Some contents...</p>
<p>Some contents...</p>
</Modal>
</div>
);
}
}
10 years ago
ReactDOM.render(<App />, mountNode);
10 years ago
````