mirror of
https://github.com/vbenjs/vue-vben-admin.git
synced 2025-01-23 09:40:25 +08:00
fix(upload): 修复上传组件删除无效bug
This commit is contained in:
parent
25699c0b60
commit
371c972cc1
@ -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<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) {
|
||||
|
Loading…
Reference in New Issue
Block a user