--- 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 App extends React.Component { state = { visible: false }; toogerHotjar = () => { const hotjar = document.getElementById('_hj_feedback_container'); if (hotjar.style.display === 'none') { hotjar.style.display = ''; } else { hotjar.style.display = 'none'; } }; showDrawer = () => { this.toogerHotjar(); this.setState({ visible: true, }); }; onClose = () => { this.setState( { visible: false, }, () => { this.toogerHotjar(); } ); }; 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 WarpApp = Form.create()(App); ReactDOM.render(, mountNode); ```