diff --git a/components/drawer/demo/from-drawer.md b/components/drawer/demo/from-drawer.md index 8c511e4d13..8b41f53792 100644 --- a/components/drawer/demo/from-drawer.md +++ b/components/drawer/demo/from-drawer.md @@ -162,9 +162,9 @@ class App extends React.Component { }} onClick={this.onClose} > - 取消 + Cancel - + diff --git a/components/drawer/demo/multi-level-drawer.md b/components/drawer/demo/multi-level-drawer.md new file mode 100644 index 0000000000..9796f8db82 --- /dev/null +++ b/components/drawer/demo/multi-level-drawer.md @@ -0,0 +1,146 @@ +--- +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, List, Form, Button, Input, Tag } from 'antd'; + +const vegetables = ['asparagus', 'bamboo', 'potato', 'carrot', 'cilantro', 'potato', 'eggplant']; + +const TagList = ({ value, onChange, show }) => { + return ( +
+ {value.map(item => { + return {item}; + })} + show()}>+ +
+ ); +}; + +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() { + const { getFieldDecorator } = this.props.form; + return ( +
+ + +
+ + {getFieldDecorator('name', { + rules: [{ required: true, message: 'please enter cookbook name' }], + })()} + + + {getFieldDecorator('Food', { + rules: [{ required: true, message: 'please enter food' }], + initialValue: ['potato', 'eggplant'], + })()} + +
+ + Vegetables
} + dataSource={vegetables} + renderItem={item => {item}} + /> + +
+ + +
+ + + ); + } +} +const WarpApp = Form.create()(App); + +ReactDOM.render(, mountNode); +``` + + diff --git a/components/drawer/index.tsx b/components/drawer/index.tsx index 698f4894c3..089093e00f 100644 --- a/components/drawer/index.tsx +++ b/components/drawer/index.tsx @@ -56,6 +56,7 @@ export default class Drawer extends React.Component< prefixCls: 'ant-drawer', width: 256, closable: true, + placement: 'right', maskClosable: true, };