React antd的FormItem结合switch设置initialValue无效

当antd formItem结合switch设置initialValue无效时,需要在getFieldDecorator 包装的控件中添加代码

valuePropName: 'checked',最后的代码呈现是这样的:


  {form.getFieldDecorator('allowReject', {
    required: true,
    initialValue:values.allowReject,
    valuePropName: 'checked'
    })(
    
  )}

 

你可能感兴趣的:(react,antd,js,react,antd)