赞
踩
Axios.get(url, { responseType:'blob' }),then(res) => {
const a = document.createElement('a')
const blob = new Blob([res.data])
const url = window.URL.createObjectURL(blob)
const name = res.headers['content-disposition']
a.href = url
a.download = decodeURIComponent(name.split('attachment;filename=')[1]) // 获取文件流名称并转码
a.click()
window.URL.revokeObjectURL(url)
)}
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。