diff --git a/src/components/Upload/src/components/UploadModal.vue b/src/components/Upload/src/components/UploadModal.vue index 698d9307a..e3db2440a 100644 --- a/src/components/Upload/src/components/UploadModal.vue +++ b/src/components/Upload/src/components/UploadModal.vue @@ -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'; @@ -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) { + 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) {