const { getFieldDecorator, getFieldsError, getFieldError, isFieldTouched, getFieldValue, getFieldsValue } = this.props.form
getFieldValue('fieldKey')
const uploadButton = (
<div>
<Icon type="plus" />
<div className="ant-upload-text">Upload</div>
</div>
)
return getFieldDecorator('fieldKey', {
valuePropName: 'fileList',
getValueFromEvent: this.normFile,
initialValue: [
{
uid: "-1",
name: "xxx.png",
status: "done",
url: "https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png"
}
]
})(
<Upload
action="/v1/img/upload"
listType="picture-card"
showUploadList={true}
headers={headers}
// onChange={info => {
// this.handleChange(info, k)
// }}
>
{
// TODO 2. 为何此时是可以取到值的呢?getFieldDecorator 的执行机机制是什么呢?
(getFieldValue('fieldKey') || []).length === 1 ? null : uploadButton
}
</Upload>
)