mirror of
https://github.com/ant-design/ant-design.git
synced 2025-06-12 12:23:08 +08:00
data should be call when beforeUpload promise resolved, close #7833
This commit is contained in:
parent
2fb304e270
commit
9a5894c46e
@ -219,12 +219,18 @@ export default class Upload extends React.Component<UploadProps, any> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
beforeUpload = (file, fileList) => {
|
beforeUpload = (file, fileList) => {
|
||||||
if (this.props.beforeUpload && !this.props.beforeUpload(file, fileList)) {
|
if (!this.props.beforeUpload) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
const result = this.props.beforeUpload(file, fileList);
|
||||||
|
if (!result) {
|
||||||
this.onChange({
|
this.onChange({
|
||||||
file,
|
file,
|
||||||
fileList,
|
fileList,
|
||||||
});
|
});
|
||||||
return false;
|
return false;
|
||||||
|
} else if ((result as PromiseLike<any>).then) {
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user