From 722c5cebf2d583586b9c92d8a66b9696dc41e4dc Mon Sep 17 00:00:00 2001 From: v_wnxinfeng Date: Tue, 16 Sep 2025 14:26:50 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BF=AE=E5=A4=8D=E4=B8=8B=E8=BD=BD?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E5=86=85=E5=AE=B9=E9=94=99=E8=AF=AF=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/components/doc-content.vue | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/frontend/src/components/doc-content.vue b/frontend/src/components/doc-content.vue index 283091a04..6a96c3417 100644 --- a/frontend/src/components/doc-content.vue +++ b/frontend/src/components/doc-content.vue @@ -104,15 +104,19 @@ const downloadFile = () => { downKnowledgeDetails(props.details.id) .then((result) => { if (result) { + if (url.value) { + URL.revokeObjectURL(url.value); + } url.value = URL.createObjectURL(result); - down.value.click(); - // const link = document.createElement("a"); - // link.style.display = "none"; - // link.setAttribute("href", url); - // link.setAttribute("download", props.details.title); - // link.click(); - // document.body.removeChild(link); - window.URL.revokeObjectURL(url); + const link = document.createElement("a"); + link.style.display = "none"; + link.setAttribute("href", url.value); + link.setAttribute("download", props.details.title); + link.click(); + nextTick(() => { + document.body.removeChild(link); + URL.revokeObjectURL(url.value); + }) } }) .catch((err) => {