js下载

需要载请求中加入{responseType: 'arraybuffer'}
var blob = new Blob([res], {
type:
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet; charset=utf-8"
});
var downloadElement = document.createElement("a");
var href = https://www.it610.com/article/window.URL.createObjectURL(blob); // 创建下载的链接
downloadElement.href = https://www.it610.com/article/href;
downloadElement.download = "白名单" + ".xls"; // 下载后文件名
document.body.appendChild(downloadElement);
downloadElement.click(); // 点击下载
document.body.removeChild(downloadElement); // 下载完成移除元素
【js下载】window.URL.revokeObjectURL(href); // 释放掉blob对象

    推荐阅读