Browse Source

🐛 添加Navigator上的msSaveBlob类型声明,修复api.ts中的eslint报错

pull/6896/head
Caffeine19 4 months ago
parent
commit
b064d3e61f
  1. 4
      jeecgboot-vue3/src/api/common/api.ts
  2. 5
      jeecgboot-vue3/types/global.d.ts

4
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);

5
jeecgboot-vue3/types/global.d.ts vendored

@ -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' {

Loading…
Cancel
Save