Antd 上传(Upload)组件报:Warning: [antd: Upload] `value` is not a valid prop, do you mean `fileList`?

错误记录:

  1. Warning: [antd: Upload] value is not a valid prop, do you mean fileList?
  2. Uncaught TypeError: (fileList || []).forEach is not a function

错误原因:上传组件(Upload)写在标签内。
根据:官方文档
解决方法:

 <Form.Item 
	 name="dragger" 
	 // 以下两条是必须的
	 valuePropName="fileList" 
	 // 如果没有下面这一句会报错
	 getValueFromEvent={normFile} 
	 noStyle
 >

注:如果没有getValueFromEvent={normFile}会报如下错误:
Uncaught TypeError: (fileList || []).forEach is not a function
Antd 上传(Upload)组件报:Warning: [antd: Upload] `value` is not a valid prop, do you mean `fileList`?_第1张图片

参考自:《antd4.x Upload配合Form表单无法使用的问题》

你可能感兴趣的:(前端Bug)