fix: 去除 downloadByData 中 IE 的支持
parent
e6c3d59071
commit
20a4579808
|
@ -36,9 +36,6 @@ export function downloadByBase64(buf: string, filename: string, mime?: string, b
|
||||||
export function downloadByData(data: BlobPart, filename: string, mime?: string, bom?: BlobPart) {
|
export function downloadByData(data: BlobPart, filename: string, mime?: string, bom?: BlobPart) {
|
||||||
const blobData = typeof bom !== 'undefined' ? [bom, data] : [data];
|
const blobData = typeof bom !== 'undefined' ? [bom, data] : [data];
|
||||||
const blob = new Blob(blobData, { type: mime || 'application/octet-stream' });
|
const blob = new Blob(blobData, { type: mime || 'application/octet-stream' });
|
||||||
if (typeof window.navigator.msSaveBlob !== 'undefined') {
|
|
||||||
window.navigator.msSaveBlob(blob, filename);
|
|
||||||
} else {
|
|
||||||
const blobURL = window.URL.createObjectURL(blob);
|
const blobURL = window.URL.createObjectURL(blob);
|
||||||
const tempLink = document.createElement('a');
|
const tempLink = document.createElement('a');
|
||||||
tempLink.style.display = 'none';
|
tempLink.style.display = 'none';
|
||||||
|
@ -51,7 +48,6 @@ export function downloadByData(data: BlobPart, filename: string, mime?: string,
|
||||||
tempLink.click();
|
tempLink.click();
|
||||||
document.body.removeChild(tempLink);
|
document.body.removeChild(tempLink);
|
||||||
window.URL.revokeObjectURL(blobURL);
|
window.URL.revokeObjectURL(blobURL);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue