Commit 158bf17d by 袁晓帅

修改IE下不能下载和不能的导出问题2

parent c090f1e3
......@@ -203,6 +203,14 @@ export default {
}
}).then(res => {
let blob = new Blob([res.data], {type: "application/vnd.ms-excel"}); // res就是接口返回的文件流了
if (window.navigator.msSaveBlob) { //IE以及IE内核的浏览器
try {
window.navigator.msSaveBlob(blob); //response为接口返回数据,这里请求的时候已经处理了,如果没处理需要在此之前自行处理var data = new Blob([response.data]) 注意这里需要是数组形式的,fileNm就是下载之后的文件名
// window.navigator.msSaveOrOpenBlob(response, fileNm); //此方法类似上面的方法,区别可自行百度
}catch (e) {
console.log(e);
}
}
let objectUrl = URL.createObjectURL(blob);
window.location.href = objectUrl;
});
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment