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
|
|
|
|
|
|
|
Basic modal dialog.
|
|
|
|
|
2017-01-19 15:19:03 +08:00
|
|
|
````__react
|
2015-10-28 20:55:49 +08:00
|
|
|
import { Modal, Button } from 'antd';
|
2015-06-04 21:17:52 +08:00
|
|
|
|
2015-10-28 20:55:49 +08:00
|
|
|
const App = React.createClass({
|
2015-09-22 15:11:29 +08:00
|
|
|
getInitialState() {
|
|
|
|
return { visible: false };
|
2015-06-12 23:31:44 +08:00
|
|
|
},
|
2015-08-18 12:26:19 +08:00
|
|
|
showModal() {
|
2015-06-12 23:31:44 +08:00
|
|
|
this.setState({
|
2016-05-11 09:32:33 +08:00
|
|
|
visible: true,
|
2015-06-12 23:31:44 +08:00
|
|
|
});
|
2015-06-10 22:02:13 +08:00
|
|
|
},
|
2015-06-12 17:11:32 +08:00
|
|
|
handleOk() {
|
2016-08-11 11:41:06 +08:00
|
|
|
console.log('Clicked OK');
|
2015-06-12 23:31:44 +08:00
|
|
|
this.setState({
|
2016-05-11 09:32:33 +08:00
|
|
|
visible: false,
|
2015-06-12 23:31:44 +08:00
|
|
|
});
|
2015-06-10 22:02:13 +08:00
|
|
|
},
|
2016-02-02 14:54:34 +08:00
|
|
|
handleCancel(e) {
|
|
|
|
console.log(e);
|
2015-09-08 12:38:21 +08:00
|
|
|
this.setState({
|
2016-05-11 09:32:33 +08:00
|
|
|
visible: false,
|
2015-09-08 12:38:21 +08:00
|
|
|
});
|
|
|
|
},
|
2015-06-12 17:11:32 +08:00
|
|
|
render() {
|
2016-01-07 16:29:12 +08:00
|
|
|
return (
|
|
|
|
<div>
|
2016-08-11 11:41:06 +08:00
|
|
|
<Button type="primary" onClick={this.showModal}>Open a modal dialog</Button>
|
|
|
|
<Modal title="Basic Modal" visible={this.state.visible}
|
2016-06-06 13:54:10 +08:00
|
|
|
onOk={this.handleOk} onCancel={this.handleCancel}
|
|
|
|
>
|
2016-08-11 11:41:06 +08:00
|
|
|
<p>some contents...</p>
|
|
|
|
<p>some contents...</p>
|
|
|
|
<p>some contents...</p>
|
2016-01-07 16:29:12 +08:00
|
|
|
</Modal>
|
|
|
|
</div>
|
|
|
|
);
|
2016-05-11 09:32:33 +08:00
|
|
|
},
|
2015-06-10 22:02:13 +08:00
|
|
|
});
|
2015-06-04 21:17:52 +08:00
|
|
|
|
2015-12-29 12:08:58 +08:00
|
|
|
ReactDOM.render(<App />, mountNode);
|
2015-06-04 21:17:52 +08:00
|
|
|
````
|