关于Ant Design中Form及input组件使用大坑解决方案

480 阅读1分钟

input中存在这样一个属性可以使其存在一个输入框默认内容,但当其在From中使用时会存在一个问题

Warning: [antd: Form.Item] defaultValue will not work on controlled Field. You should use initialValues of Form instead.

可知defaultValue在Form表单中不能正常工作,并且无法在提交时正常上传Value值。

image.png

image.png

解决方案:

image.png