UNPKG

cjd-parkball

Version:

> 中后台业务组件库,中后台就像公园,进入需要买门票(登录),所以以 Parkball(公园球) 命名,公园内必定捕获!作为一个组件库,提供使用方法文档,方便开发者的调用

103 lines (90 loc) 2.2 kB
--- category: 2 title: 多层抽屉 title_en: 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 'parkball'; class App extends React.Component { state = { visible: false, childrenDrawer: false }; showDrawer = () => { this.setState({ visible: true, }); }; onClose = () => { this.setState({ visible: false, }); }; showChildrenDrawer = () => { this.setState({ childrenDrawer: true, }); }; onChildrenDrawerClose = () => { this.setState({ childrenDrawer: false, }); }; 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="Two-level Drawer" 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); ```