|
@@ -36,7 +36,7 @@ function errorResponse(vm, response, err) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-function downFile(blob, fileName) {
|
|
|
+function downFile(blob, fileName, success) {
|
|
|
// 非IE下载
|
|
|
if ("download" in document.createElement("a")) {
|
|
|
let link = document.createElement("a");
|
|
@@ -47,9 +47,11 @@ function downFile(blob, fileName) {
|
|
|
link.click(); // 点击下载
|
|
|
window.URL.revokeObjectURL(link.href); // 释放掉blob对象
|
|
|
document.body.removeChild(link); // 下载完成移除元素
|
|
|
+ success && success()
|
|
|
} else {
|
|
|
// IE10+下载
|
|
|
window.navigator.msSaveBlob(blob, fileName);
|
|
|
+ success && success()
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -169,7 +171,7 @@ export default {
|
|
|
console.log(error);
|
|
|
});
|
|
|
},
|
|
|
- download(url, requestData) {
|
|
|
+ download(url, requestData, success) {
|
|
|
// 响应类型:arraybuffer, blob
|
|
|
fetch
|
|
|
.post(url, requestData, { responseType: "blob" })
|
|
@@ -193,7 +195,7 @@ export default {
|
|
|
);
|
|
|
}
|
|
|
console.log("文件名称:", fileName);
|
|
|
- downFile(blob, fileName);
|
|
|
+ downFile(blob, fileName, success);
|
|
|
}
|
|
|
})
|
|
|
.catch(function(error) {
|