請求頭添加 responseType:'blob' 或者‘arraybuffer’
轉換成圖片
var blob = new Blob([res.data], { type: 'image/png' });
// 創(chuàng)建圖片的URL
var imageUrl = URL.createObjectURL(blob);
轉換成excel
var blob = new Blob([res], {
type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel,charset=utf-8'
});
var url = URL.createObjectURL(blob);