mirror of
https://github.com/ant-design/ant-design.git
synced 2024-11-29 05:29:37 +08:00
fix: should trigger onChange before beforeUpload
This commit is contained in:
parent
47e3cedf86
commit
9dc4102cdd
@ -218,6 +218,17 @@ export default class Upload extends React.Component<UploadProps, any> {
|
||||
});
|
||||
}
|
||||
|
||||
beforeUpload = (file, fileList) => {
|
||||
if (this.props.beforeUpload && !this.props.beforeUpload(file, fileList)) {
|
||||
this.onChange({
|
||||
file,
|
||||
fileList,
|
||||
});
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
clearProgressTimer() {
|
||||
clearInterval(this.progressTimer);
|
||||
}
|
||||
@ -234,6 +245,7 @@ export default class Upload extends React.Component<UploadProps, any> {
|
||||
onProgress: this.onProgress,
|
||||
onSuccess: this.onSuccess,
|
||||
...this.props,
|
||||
beforeUpload: this.beforeUpload,
|
||||
};
|
||||
|
||||
delete rcUploadProps.className;
|
||||
|
Loading…
Reference in New Issue
Block a user