diff --git a/src/views/financialinformation/quarterlyresults/size1440/index.vue b/src/views/financialinformation/quarterlyresults/size1440/index.vue index a49b74b..97d41ae 100644 --- a/src/views/financialinformation/quarterlyresults/size1440/index.vue +++ b/src/views/financialinformation/quarterlyresults/size1440/index.vue @@ -25,13 +25,17 @@ class="result-item" >
- {{ item.title }} +

{{ item.title }}

{{ item.description }}

-
- - PDF - + +
+ PDF + {{ t("financialinformation.quarterlyresults.download") }}
@@ -341,6 +345,31 @@ const handleSearch = () => { // 搜索处理逻辑 console.log("搜索:", searchQuery.value); }; +const downloadPdf = async (pdfResource, filename = "") => { + try { + // 获取PDF文件 + const response = await fetch(pdfResource); + const blob = await response.blob(); + + // 创建Blob URL + const blobUrl = URL.createObjectURL(blob); + + // 创建下载链接 + const a = document.createElement("a"); + a.href = blobUrl; + a.download = filename || pdfResource.split("/").pop() || "download.pdf"; + + // 触发下载 + document.body.appendChild(a); + a.click(); + document.body.removeChild(a); + + // 释放Blob URL + URL.revokeObjectURL(blobUrl); + } catch (error) { + console.error("下载PDF文件失败:", error); + } +};