Browse Source

data should be call when beforeUpload promise resolved, close #7833

pull/7837/merge
afc163 7 years ago
parent
commit
9a5894c46e
  1. 8
      components/upload/Upload.tsx

8
components/upload/Upload.tsx

@ -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…
Cancel
Save