前端在发送请求时携带(responseType:‘blob’)
var token = sessionStorage.httpToken axios.defaults.headers.common.token = token axios({ methods: 'GET', url: 'http://baidu.com', responseType: 'blob' }).then(res => { let blob = new Blob([res.data], {type: 'application/xls'}) let url = window.URL.createObjectURL(blob) // 重命名文件名称 let a = document.createElement('a') a.setAttribute('href', url) a.setAttribute('download', '123.xls') a.click() })