From 87421d02ee7cd95bf359ecdbaf664fa9cdff55b6 Mon Sep 17 00:00:00 2001 From: yinq Date: Tue, 2 Dec 2025 11:12:00 +0800 Subject: [PATCH] =?UTF-8?q?1.0.41=20=E4=B8=8A=E4=BC=A0=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/FileUpload/index.vue | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/components/FileUpload/index.vue b/src/components/FileUpload/index.vue index 1767b1b..4230ad9 100644 --- a/src/components/FileUpload/index.vue +++ b/src/components/FileUpload/index.vue @@ -33,10 +33,9 @@
  • - - {{ getFileName(file.name) }} - + {{ getFileName(file.name) }}
    + 下载 删除
  • @@ -93,7 +92,8 @@ watch( if (Array.isArray(val)) { list = val; } else { - const res = await listByIds(val); + const ossIdParam = typeof val === 'string' || typeof val === 'number' ? val : String(val); + const res = await listByIds(ossIdParam); list = res.data.map((oss) => { return { name: oss.originalName, @@ -174,6 +174,15 @@ const handleUploadSuccess = (res: any, file: UploadFile) => { } }; +// 下载文件 +const handleDownload = (file: any) => { + if (file.ossId) { + proxy?.$download.oss(file.ossId); + } else { + proxy?.$modal.msgWarning('文件ID不存在,无法下载'); + } +}; + // 删除文件 const handleDelete = (index: number) => { const ossId = fileList.value[index].ossId;