UNPKG

cjd-parkball

Version:

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

75 lines (62 loc) 1.48 kB
--- category: 2 title: 自定义位置 title_en: Custom Placement --- zh-CN 自定义位置,点击触发按钮抽屉从相应的位置滑出,点击遮罩区关闭 en-US Basic drawer. ```jsx import { Drawer, Button, Radio } from 'parkball'; const RadioGroup = Radio.Group; class App extends React.Component { state = { visible: false, placement: 'left' }; showDrawer = () => { this.setState({ visible: true, }); }; onClose = () => { this.setState({ visible: false, }); }; onChange = (e) => { this.setState({ placement: e.target.value, }); } render() { return ( <div> <RadioGroup style={{ marginRight: 8 }} defaultValue={this.state.placement} onChange={this.onChange} > <Radio value="top">top</Radio> <Radio value="right">right</Radio> <Radio value="bottom">bottom</Radio> <Radio value="left">left</Radio> </RadioGroup> <Button type="primary" onClick={this.showDrawer}> Open </Button> <Drawer title="Basic Drawer" placement={this.state.placement} closable={false} 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); ```