File tree Expand file tree Collapse file tree
packages/components/upload/hooks Expand file tree Collapse file tree Original file line number Diff line number Diff 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 ) ;
You can’t perform that action at this time.
0 commit comments