From 174e3b3a545e4cb9351e5a262c4b2f0de6c6e50a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E5=A8=9C?= Date: Mon, 14 Apr 2025 20:40:31 +0800 Subject: [PATCH] =?UTF-8?q?=E6=89=B9=E9=87=8F=E4=B8=8B=E8=BD=BD=E9=97=AE?= =?UTF-8?q?=E9=A2=98=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/knowledgeFile/index.vue | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/views/knowledgeFile/index.vue b/src/views/knowledgeFile/index.vue index 1cbc881..16616b2 100644 --- a/src/views/knowledgeFile/index.vue +++ b/src/views/knowledgeFile/index.vue @@ -1389,9 +1389,17 @@ const handleUploadMyFile = (options: any) => { }); }; -const handleDownloadFile = (downloadData: any) => { - downloadData.forEach((item: { id: any }) => { - window.open(`${window.origin}/witchaind/api/doc/download?id=${item.id}`); - }); +const handleDownloadFile = async (downloadData: any) => { + for (const item of downloadData) { + const url = `${window.origin}/witchaind/api/doc/download?id=${item.id}`; + const a = document.createElement('a'); + a.href = url; + a.download = 'filename'; // 指定文件名 + a.style.display = 'none'; + document.body.appendChild(a); + a.click(); + document.body.removeChild(a); + await new Promise(resolve => setTimeout(resolve, 333)); // 添加延迟 + } }; -- Gitee