Skip to content

Commit

Permalink
Merge pull request #3988 from snapea/fix/mult-upload
Browse files Browse the repository at this point in the history
fix(upload): 修复上传组件删除无效bug
  • Loading branch information
vince292007 authored Jul 31, 2024
2 parents 1698be7 + 371c972 commit c37ed8f
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/components/Upload/src/components/UploadModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
import { useMessage } from '@/hooks/web/useMessage';
// types
import { FileItem, UploadResultStatus } from '../types/typing';
import { basicProps } from '../props';
import { handleFnKey, basicProps } from '../props';
import { createTableColumns, createActionColumn } from './data';
// utils
import { checkImgType, getBase64WithFile } from '../helper';
Expand Down Expand Up @@ -161,13 +161,13 @@
}
// 删除
function handleRemove(record: FileItem) {
const index = fileListRef.value.findIndex((item) => item.uuid === record.uuid);
index !== -1 && fileListRef.value.splice(index, 1);
isUploadingRef.value = fileListRef.value.some(
(item) => item.status === UploadResultStatus.UPLOADING,
);
emit('delete', record);
function handleRemove(obj: Record<handleFnKey, any>) {
let { record = {}, uidKey = 'uid' } = obj;
const index = fileListRef.value.findIndex((item) => item[uidKey] === record[uidKey]);
if (index !== -1) {
const removed = fileListRef.value.splice(index, 1);
emit('delete', removed[0][uidKey]);
}
}
async function uploadApiByItem(item: FileItem) {
Expand Down

0 comments on commit c37ed8f

Please sign in to comment.