mirror of
https://github.com/ant-design/ant-design.git
synced 2024-12-01 23:29:30 +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() {
|
clearProgressTimer() {
|
||||||
clearInterval(this.progressTimer);
|
clearInterval(this.progressTimer);
|
||||||
}
|
}
|
||||||
@ -234,6 +245,7 @@ export default class Upload extends React.Component<UploadProps, any> {
|
|||||||
onProgress: this.onProgress,
|
onProgress: this.onProgress,
|
||||||
onSuccess: this.onSuccess,
|
onSuccess: this.onSuccess,
|
||||||
...this.props,
|
...this.props,
|
||||||
|
beforeUpload: this.beforeUpload,
|
||||||
};
|
};
|
||||||
|
|
||||||
delete rcUploadProps.className;
|
delete rcUploadProps.className;
|
||||||
|
Loading…
Reference in New Issue
Block a user