2018-05-23 10:56:37 +08:00
|
|
|
---
|
|
|
|
order: 0
|
|
|
|
title:
|
2018-06-22 15:46:21 +08:00
|
|
|
zh-CN: 基础抽屉
|
2018-05-23 10:56:37 +08:00
|
|
|
en-US: Basic
|
|
|
|
---
|
|
|
|
|
|
|
|
## zh-CN
|
|
|
|
|
2018-06-22 15:46:21 +08:00
|
|
|
基础抽屉,点击触发按钮抽屉从右滑出,点击遮罩区关闭
|
2018-05-23 10:56:37 +08:00
|
|
|
|
|
|
|
## en-US
|
|
|
|
|
2018-05-23 11:13:50 +08:00
|
|
|
Basic drawer.
|
2018-05-23 10:56:37 +08:00
|
|
|
|
|
|
|
```jsx
|
|
|
|
import { Drawer, Button } from 'antd';
|
|
|
|
|
|
|
|
class App extends React.Component {
|
|
|
|
state = { visible: false };
|
2018-07-04 08:29:42 +08:00
|
|
|
|
2018-05-23 10:56:37 +08:00
|
|
|
showDrawer = () => {
|
|
|
|
this.setState({
|
|
|
|
visible: true,
|
|
|
|
});
|
|
|
|
};
|
2018-07-04 08:29:42 +08:00
|
|
|
|
2018-05-23 10:56:37 +08:00
|
|
|
onClose = () => {
|
2018-06-29 11:57:33 +08:00
|
|
|
this.setState({
|
|
|
|
visible: false,
|
|
|
|
});
|
2018-05-23 10:56:37 +08:00
|
|
|
};
|
2018-07-04 08:29:42 +08:00
|
|
|
|
2018-05-23 10:56:37 +08:00
|
|
|
render() {
|
|
|
|
return (
|
|
|
|
<div>
|
|
|
|
<Button type="primary" onClick={this.showDrawer}>
|
|
|
|
Open
|
|
|
|
</Button>
|
|
|
|
<Drawer
|
|
|
|
title="Basic Drawer"
|
2018-05-27 00:00:07 +08:00
|
|
|
placement="right"
|
2018-06-22 15:46:21 +08:00
|
|
|
closable={false}
|
2018-05-23 10:56:37 +08:00
|
|
|
onClose={this.onClose}
|
|
|
|
visible={this.state.visible}
|
|
|
|
>
|
|
|
|
<p>Some contents...</p>
|
|
|
|
<p>Some contents...</p>
|
|
|
|
<p>Some contents...</p>
|
|
|
|
</Drawer>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
ReactDOM.render(<App />, mountNode);
|
|
|
|
```
|
2018-06-29 11:57:33 +08:00
|
|
|
|
|
|
|
|
|
|
|
<style>
|
|
|
|
#_hj_feedback_container{
|
|
|
|
display:none
|
|
|
|
}
|
|
|
|
</style>
|