|
|
@@ -14,12 +14,10 @@ export const downloadFile = (url: string | Blob, fileName: string) => {
|
|
|
window.URL.revokeObjectURL(url)
|
|
|
}
|
|
|
let newUrl: any = ''
|
|
|
- if (typeof url === 'object' && url instanceof Blob) {
|
|
|
+ if (url instanceof Blob) {
|
|
|
newUrl = URL.createObjectURL(newUrl) // 创建blob地址
|
|
|
download(newUrl, fileName)
|
|
|
} else {
|
|
|
- fetch(newUrl).then((res) => res.blob()).then((blob) => {
|
|
|
- download(blob, fileName)
|
|
|
- })
|
|
|
+ fetch(newUrl).then((res) => res.blob()).then((blob) => download(blob, fileName))
|
|
|
}
|
|
|
}
|