--- order: 3 title: zh-CN: 对象编辑 en-US: Edit item in drawer --- ## zh-CN 用于承载编辑相关操作,需要点击关闭按钮关闭。 ## en-US A drawer containing an editable form which needs to be collapsed by clicking the close button. ```jsx import { Drawer, Form, Button, Col, Row, Input, Select, DatePicker } from 'antd'; const { Option } = Select; class DrawerForm extends React.Component { state = { visible: false }; showDrawer = () => { this.setState({ visible: true, }); }; onClose = () => { this.setState({ visible: false, }); }; render() { const { getFieldDecorator } = this.props.form; return (
{getFieldDecorator('name', { rules: [{ required: true, message: 'please enter user name' }], })()} {getFieldDecorator('url', { rules: [{ required: true, message: 'please enter url' }], })( )} {getFieldDecorator('owner', { rules: [{ required: true, message: 'Please select an owner' }], })( )} {getFieldDecorator('type', { rules: [{ required: true, message: 'Please choose the type' }], })( )} {getFieldDecorator('approver', { rules: [{ required: true, message: 'Please choose the approver' }], })( )} {getFieldDecorator('dateTime', { rules: [{ required: true, message: 'Please choose the dateTime' }], })( trigger.parentNode} /> )} {getFieldDecorator('description', { rules: [ { required: true, message: 'please enter url description', }, ], })()}
); } } const App = Form.create()(DrawerForm); ReactDOM.render(, mountNode); ```