使用npm 或者 yarn 下载axios包
- npm
npm install axios -S
- yarn
yarn add axios -S
文件下载
文件的后缀需要准确 不然会导致乱码
axios.get(url,{responseType:"blob"}).then(res=>{
const blob = new Blob([res.data]);
let url = window.URL.createObjectURL(blob);
const a = document.createElement('a');
a.href = url;
a.download = 'xxx.xlsx(文件名)
a.click();
window.URL.revokeObjectURL(url)
})