소스 검색

update ruoyi-ui/src/utils/zipdownload.js.
BLOB下载时清除URL对象引用

ytzjf 4 년 전
부모
커밋
98d25fa16e
1개의 변경된 파일2개의 추가작업 그리고 0개의 파일을 삭제
  1. 2 0
      ruoyi-ui/src/utils/zipdownload.js

+ 2 - 0
ruoyi-ui/src/utils/zipdownload.js

@@ -32,9 +32,11 @@ export function resolveBlob(res, mimeType) {
32 32
   var result = patt.exec(contentDisposition)
33 33
   var fileName = result[1]
34 34
   fileName = fileName.replace(/\"/g, '')
35
+  aLink.style.display = 'none'
35 36
   aLink.href = URL.createObjectURL(blob)
36 37
   aLink.setAttribute('download', fileName) // 设置下载文件名称
37 38
   document.body.appendChild(aLink)
38 39
   aLink.click()
40
+  URL.revokeObjectURL(aLink.href);//清除引用
39 41
   document.body.removeChild(aLink);
40 42
 }