// file是要下载的文件(blob对象)
downloadHandler:
function
(file, fileName) {
let link = document.createElement(
'a'
)
link.href = window.URL.createObjectURL(file)
link.download = fileName
link.click()
window.URL.revokeObjectURL(link.href)
if
(navigator.userAgent.indexOf(
'Firefox'
) > -1) {
const a = document.createElement(
'a'
)
a.addEventListener(
'click'
,
function
(e) {
a.download = fileName
a.href = URL.createObjectURL(file)
})
let e = document.createEvent(
'MouseEvents'
)
e.initEvent(
'click'
,
false
,
false
)
a.dispatchEvent(e)
}
}