<Form.Item>
{getFieldDecorator('discount_name', {
rules: [{required: true, message: ' '}],
})(
<div>
<Select
showSearch
style={{ width: 200 }}
placeholder="Select a person"
optionFilterProp="children"
onChange={handleChange}
onFocus={handleFocus}
onBlur={handleBlur}
filterOption={(input, option) => option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0}
>
<Select.Option value="jack">Jack</Select.Option>
<Select.Option value="lucy">Lucy</Select.Option>
<Select.Option value="tom">Tom</Select.Option>
</Select>
</div>
)}
</Form.Item>
如果包了一层div后,在使用validateFields验证的时候通过不了验证,取不到值
getFieldDecorator
里面必须提供一个可控组件
,并且有onChange
方法和value
值。