https://www.jianshu.com/p/cb6925298a7c
this.$axios.get('XXXXXXX',{ responseType:'blob' //告訴服務器我們需要的響應格式 }) .then(res => { let blob = new Blob([res.data],{ type:'application/vnd.ms-excel' //將會被放入到blob中的數組內容的MIME類型 }); let objectUrl = URL.createObjectURL(blob); //生成一個url window.location.href = objectUrl; //瀏覽器打開這個url }) .catch(err => { console.log(err); })
https://blog.csdn.net/weixin_30950237/article/details/100093685
出現excel亂碼把
responseType: 'blob' 改為
responseType: 'arraybuffer'
