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;