import axios from '@/common/services/axios-instance'
function download(url, fname) {
return axios({
url,
responseType: 'blob',
}).then((res) => {
if (flag) ProgressBar.done()
if ('msSaveOrOpenBlob' in window.navigator) {
window.navigator.msSaveOrOpenBlob(res.data, fname)
return
}
const blobUrl = URL.createObjectURL(res.data)
const a = document.createElement('a')
a.href = blobUrl
a.download = fname
var evt = document.createEvent('MouseEvents')
evt.initEvent('click', true, true)
a.dispatchEvent(evt)
URL.revokeObjectURL(blobUrl)
})
}
export default download