匹配的具名-仍无法读取未定义的属性'getFieldDecorator'

时间:2018-07-02 19:59:43

标签: reactjs antd

不确定我缺少什么?但是我确实有两个出口。 如果我删除getFieldDecorator没有错误,但显然我需要提交此表格。该错误的确切含义是什么?

const FormItem = Form.Item
class Editor extends React.Component {
    handleSubmit = event => {
       addActivity(event).then(response => {
       console.log('post response ' + response)
      })
     }
      render() {
          const { getFieldDecorator } = this.props.form

          return (
            <Form onSubmit={this.handleSubmit}>
                  <Col span={13} offset={1}>
                    <label>Comments</label>
                     <Form.Item>
                    {getFieldDecorator('Comments', {
                      rules: [{ required: true }]
                    })(
                      <TextArea placeholder="(optional) Comments" rows="4" />
                    )}
                     </Form.Item>
                  </Col>
            </Form>
        )
     }
    }

      const EditorForm = Form.create()(Editor)
      const ConsumerProps= props => (
        <SecurityContext.Consumer>
          {ctx => <Editor {...props} comsumerId={ctx.comsumerId} />}
        </SecurityContext.Consumer>
      )

    export default (EditorForm, ConsumerProps)

0 个答案:

没有答案