From d77e4e8f6733fd085392f124b5b05b2aa8b9ffbd Mon Sep 17 00:00:00 2001 From: buaixuexideshitongxue <2936013465@qq.com> Date: Tue, 13 Jan 2026 17:53:16 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=87=E4=BB=B6=E6=B5=8F=E8=A7=88=E7=BB=84?= =?UTF-8?q?=E4=BB=B6--=E7=82=B9=E5=87=BB=E9=A2=84=E8=A7=88=E7=9A=84?= =?UTF-8?q?=E6=97=B6=E5=80=99=E7=9B=B4=E6=8E=A5=E4=B8=8B=E8=BD=BD=EF=BC=8C?= =?UTF-8?q?=E5=8E=BB=E9=99=A4=E4=B8=8B=E8=BD=BD=E6=96=87=E4=BB=B6=E3=80=81?= =?UTF-8?q?=E6=89=93=E5=8D=B0=E6=96=87=E4=BB=B6=E6=8C=89=E9=92=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/file/list.vue | 34 ++++++++++++++++++++++------------ 1 file changed, 22 insertions(+), 12 deletions(-) diff --git a/src/components/file/list.vue b/src/components/file/list.vue index 168fae8..3d45a91 100644 --- a/src/components/file/list.vue +++ b/src/components/file/list.vue @@ -205,18 +205,18 @@
- - - 下载文件 - - - - 打印文件 - + + + + + + + + + + + +
@@ -265,6 +265,7 @@ function filePreview(file) { translateX.value = 0; translateY.value = 0; moveFlag = false; + downloadFile(file) // if (!file?.filePath) { // ElMessage?.warning?.('文件路径不存在,无法下载') // return @@ -309,6 +310,15 @@ function filePreview(file) { // moveFlag = false; } +function downloadFile(file) { + const a = document.createElement('a') + a.href = `${BASE_PATH}/file/stream/${file.filePath}` + a.download = file.fileName || '' + a.style.display = 'none' + document.body.appendChild(a) + a.click() + document.body.removeChild(a) +} function remove(index) { const files = [...props.files];