|
@@ -13,10 +13,9 @@ export const downloadFile = (url: string | Blob, fileName: string) => {
|
|
|
// 移除blob对象的url
|
|
// 移除blob对象的url
|
|
|
window.URL.revokeObjectURL(url)
|
|
window.URL.revokeObjectURL(url)
|
|
|
}
|
|
}
|
|
|
- let newUrl: any = ''
|
|
|
|
|
|
|
+
|
|
|
if (url instanceof Blob) {
|
|
if (url instanceof Blob) {
|
|
|
- newUrl = URL.createObjectURL(newUrl) // 创建blob地址
|
|
|
|
|
- download(newUrl, fileName)
|
|
|
|
|
|
|
+ download(url, fileName)
|
|
|
} else {
|
|
} else {
|
|
|
fetch(newUrl).then((res) => res.blob()).then((blob) => download(blob, fileName))
|
|
fetch(newUrl).then((res) => res.blob()).then((blob) => download(blob, fileName))
|
|
|
}
|
|
}
|