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.

110 lines
2.2 KiB

---
order: 5
title:
zh-CN: 多层抽屉
en-US: Multi-level drawer
---
## zh-CN
在抽屉内打开新的抽屉,用以解决多分支任务的复杂状况。
## en-US
Open a new drawer on top of an existing drawer to handle multi branch tasks
```jsx
import { Drawer, Button } from 'antd';
class App extends React.Component {
state = { visible: false, childrenDrawer: false };
6 years ago
showDrawer = () => {
this.setState({
visible: true,
});
};
6 years ago
onClose = () => {
this.setState({
visible: false,
});
};
6 years ago
showChildrenDrawer = () => {
this.setState({
childrenDrawer: true,
});
};
6 years ago
onChildrenDrawerClose = () => {
this.setState({
childrenDrawer: false,
});
};
6 years ago
render() {
return (
<div>
<Button type="primary" onClick={this.showDrawer}>
Open drawer
</Button>
<Drawer
title="Multi-level drawer"
width={520}
closable={false}
onClose={this.onClose}
visible={this.state.visible}
>
<Button type="primary" onClick={this.showChildrenDrawer}>
Two-level drawer
</Button>
<Drawer
title="Food"
width={320}
closable={false}
onClose={this.onChildrenDrawerClose}
visible={this.state.childrenDrawer}
>
This is two-level drawer
</Drawer>
<div
style={{
position: 'absolute',
bottom: 0,
width: '100%',
borderTop: '1px solid #e8e8e8',
padding: '10px 16px',
textAlign: 'right',
left: 0,
background: '#fff',
borderRadius: '0 0 4px 4px',
}}
>
<Button
style={{
marginRight: 8,
}}
onClick={this.onClose}
>
Cancel
</Button>
<Button onClick={this.onClose} type="primary">
Submit
</Button>
</div>
</Drawer>
</div>
);
}
}
ReactDOM.render(<App />, mountNode);
```
<style>
#_hj_feedback_container{
display:none
}
</style>