From b064d3e61f13548dd5f56c700722ac2334088818 Mon Sep 17 00:00:00 2001 From: Caffeine19 <108726581+Caffeine19@users.noreply.github.com> Date: Mon, 15 Jul 2024 14:22:16 +0800 Subject: [PATCH] =?UTF-8?q?:bug:=20=E6=B7=BB=E5=8A=A0Navigator=E4=B8=8A?= =?UTF-8?q?=E7=9A=84msSaveBlob=E7=B1=BB=E5=9E=8B=E5=A3=B0=E6=98=8E?= =?UTF-8?q?=EF=BC=8C=E4=BF=AE=E5=A4=8Dapi.ts=E4=B8=AD=E7=9A=84eslint?= =?UTF-8?q?=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- jeecgboot-vue3/src/api/common/api.ts | 4 ++-- jeecgboot-vue3/types/global.d.ts | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/jeecgboot-vue3/src/api/common/api.ts b/jeecgboot-vue3/src/api/common/api.ts index 47d5cfbb..c1c35308 100644 --- a/jeecgboot-vue3/src/api/common/api.ts +++ b/jeecgboot-vue3/src/api/common/api.ts @@ -112,8 +112,8 @@ export const downloadFile = (url, fileName?, parameter?) => { if (typeof window.navigator.msSaveBlob !== 'undefined') { window.navigator.msSaveBlob(new Blob([data]), fileName); } else { - let url = window.URL.createObjectURL(new Blob([data])); - let link = document.createElement('a'); + const url = window.URL.createObjectURL(new Blob([data])); + const link = document.createElement('a'); link.style.display = 'none'; link.href = url; link.setAttribute('download', fileName); diff --git a/jeecgboot-vue3/types/global.d.ts b/jeecgboot-vue3/types/global.d.ts index 51487325..13607fc0 100644 --- a/jeecgboot-vue3/types/global.d.ts +++ b/jeecgboot-vue3/types/global.d.ts @@ -80,6 +80,11 @@ declare global { [elem: string]: any; } } + + interface Navigator { + // fix:msSaveBlob dose exist on type Navigator + msSaveBlob?: (blob: any, defaultName?: string) => boolean; + } } declare module 'vue' {