-
-
Notifications
You must be signed in to change notification settings - Fork 47k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
使用 Form getFieldDecorator 遇到的问题 #3976
Comments
目前没想到办法区分用户自行设置的属性和默认属性。 |
有点坑,不过构建后的代码没有警告,先这样了。 |
怎么解决的啊大神 |
改成用initialValue? |
有办法解决么 |
benjycui 说的对 |
upload 组件 <FormItem
{...formItemLayout}
label="图片"
>
{getFieldDecorator('picurls', {
valuePropName: 'fileList',
initialValue: item ? item.picurls : [],
getValueFromEvent: this.handleChange
})(
<Upload
action={pkage.imgServer+"upload"}
listType="picture-card"
data={{prx:'jpg,png,gif,jpeg'}}
onPreview={this.handlePreview}
onChange={this.handleChange}
>
{uploadButton}
</Upload>
)}
</FormItem> 初始化的值格式,与后添加的值格式,getFieldsValue 获取的两种数据类型 |
too much bugs!
must keep
|
使用setFieldsValue 里面的属性的设置来代替Value? |
|
应该在 |
Input 组件设置 valuePropName: 'disabled' , 也有问题; |
antd 里面很多的组件都是内部用state去管理,state根据控制层的props变化,这样state可以有设置默认值等各种行为 |
解决思路是在原来的设置了 defaultProps 的组件再包装一层,可以避免这个 warning。 |
对的,我就是自定义 markdown 编辑器设置了 defaultProps 后出现了这个 warning。 |
去掉了defaultProps里的value,但是报了这种错,有设置initialValue且initialValue不为undefined:
大佬能解答一下吗?自定义组件只是封装了一下inputNumber。另外,input和inputNumber包了个其它元素,getFieldDecorator就没法对它赋值和onChange操作了? |
用法问题吧,我的在 antd 表单中使用组件的方式是这样的
你的 initialValue 在组件初始化的时候是不是未定义? |
index.js:1 Warning: |
Editor 是我自定义的组件,程序可以执行但是报了个警告:
Warning:
getFieldDecorator
will overridevalue
, so please don't setvalue
directly and usesetFieldsValue
to set it.The text was updated successfully, but these errors were encountered: