Warning: `defaultValue` is invalid for `getFieldDecorator` will set `value`, please use `option.initialValue` instead.
{getFieldDecorator('message', {
rules: [{ required: true }],
})(
<TextArea defaultValue="默认值" />
)}
会报错
Warning: `defaultValue` is invalid for `getFieldDecorator` will set `value`, please use `option.initialValue` instead.
可改为:
{getFieldDecorator('joinin_message', {
rules: [{ required: true }],
initialValue: "默认值"
})(
<TextArea />
)}
如果默认值是变量data.value
,则这样写:
{getFieldDecorator('joinin_message', {
rules: [{ required: true }],
initialValue: data.value
})(
<TextArea rows={4} cols={73} style={{ marginLeft: 70 }} />
)}
data.value
不要在用 {}
包裹