axios下载文件
axios.get(url, { params: { }, headers: { Authorization: }, responseType: 'blob' // 切记类型 blob }).then((res) => { console.log(res) const blob = new Blob([res.data]) const url = window.URL.createObjectURL(blob) // 创建 url 并指向 blob const a = document.createElement('a') a.href = url a.setAttribute('download', 'excel.xls') document.body.appendChild(a) a.click() window.URL.revokeObjectURL(url) // 释放该 url }).catch((err) => { console.log(err) })