vue 通过url下载pdf文件
试过了各种a标签以及blob对象都下载不成功最后找了个插件download.jsGitHub - rndme/download: file downloading using client-side javascript1.npm install downloadjs2.import download from 'downloadjs'3.download(url,'/test.pdf')...
·
download(ulrs, name) {
fetch(urls).then((res) => {
res.blob().then((blob) => {
const url = window.URL.createObjectURL(blob)
const a = document.createElement('a')
a.href = url
a.download = name + '.xlsx';
a.click()
window.URL.revokeObjectURL(url)
})
})
}
更多推荐
已为社区贡献4条内容
所有评论(0)