mirror of
https://github.com/ant-design/ant-design.git
synced 2025-06-10 11:03:19 +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) => {
|
||||
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({
|
||||
file,
|
||||
fileList,
|
||||
});
|
||||
return false;
|
||||
} else if ((result as PromiseLike<any>).then) {
|
||||
return result;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user