2018-05-23 10:56:37 +08:00
|
|
|
---
|
2018-06-28 16:17:22 +08:00
|
|
|
order: 1
|
2018-05-23 10:56:37 +08:00
|
|
|
title:
|
2018-06-28 16:17:22 +08:00
|
|
|
zh-CN: 左侧滑出
|
|
|
|
en-US: Left Silder
|
2018-05-23 10:56:37 +08:00
|
|
|
---
|
|
|
|
|
|
|
|
## zh-CN
|
|
|
|
|
2018-06-28 16:17:22 +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-06-28 16:17:22 +08:00
|
|
|
placement="left"
|
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>
|