Skip to content

Commit 04c0d13

Browse files
committed
fix: remove not work
1 parent 3348c35 commit 04c0d13

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

packages/components/upload/hooks/useUpload.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -349,12 +349,12 @@ export default function useUpload(props: TdUploadProps) {
349349
setToUploadFiles([]);
350350
xhrReq.current = [];
351351
} else if (!props.autoUpload) {
352-
uploadValue.splice(p.index, 1);
353-
updateInternalValue([...uploadValue], changePrams);
352+
const newUploadValue = uploadValue.filter((_, i) => i !== p.index);
353+
updateInternalValue(newUploadValue, changePrams);
354354
} else if (p.index < uploadValue.length) {
355355
// autoUpload 场景下, p.index < uploadValue.length 表示移除已经上传成功的文件;反之表示移除待上传列表文件
356-
uploadValue.splice(p.index, 1);
357-
updateInternalValue([...uploadValue], changePrams);
356+
const newUploadValue = uploadValue.filter((_, i) => i !== p.index);
357+
updateInternalValue(newUploadValue, changePrams);
358358
} else {
359359
const tmpFiles = [...toUploadFiles];
360360
tmpFiles.splice(p.index - uploadValue.length, 1);

0 commit comments

Comments
 (0)