mirror of
https://gitee.com/ant-design/ant-design.git
synced 2024-12-01 03:29:39 +08:00
Fix removed upload item bug, close #2342
This commit is contained in:
parent
b40205461e
commit
129df7dc2a
@ -140,21 +140,25 @@ export default class Upload extends React.Component {
|
||||
} catch (e) { /* do nothing */ }
|
||||
let fileList = this.state.fileList;
|
||||
let targetItem = getFileItem(file, fileList);
|
||||
// 之前已经删除
|
||||
if (targetItem) {
|
||||
targetItem.status = 'done';
|
||||
targetItem.response = response;
|
||||
this.onChange({
|
||||
file: targetItem,
|
||||
fileList,
|
||||
});
|
||||
// removed
|
||||
if (!targetItem) {
|
||||
return;
|
||||
}
|
||||
targetItem.status = 'done';
|
||||
targetItem.response = response;
|
||||
this.onChange({
|
||||
file: targetItem,
|
||||
fileList,
|
||||
});
|
||||
}
|
||||
|
||||
onProgress = (e, file) => {
|
||||
let fileList = this.state.fileList;
|
||||
let targetItem = getFileItem(file, fileList);
|
||||
if (!targetItem) return;
|
||||
// removed
|
||||
if (!targetItem) {
|
||||
return;
|
||||
}
|
||||
targetItem.percent = e.percent;
|
||||
this.onChange({
|
||||
event: e,
|
||||
@ -167,6 +171,10 @@ export default class Upload extends React.Component {
|
||||
this.clearProgressTimer();
|
||||
let fileList = this.state.fileList;
|
||||
let targetItem = getFileItem(file, fileList);
|
||||
// removed
|
||||
if (!targetItem) {
|
||||
return;
|
||||
}
|
||||
targetItem.error = error;
|
||||
targetItem.response = response;
|
||||
targetItem.status = 'error';
|
||||
|
Loading…
Reference in New Issue
Block a user