This commit is contained in:
Taric Xin
2022-04-12 17:33:06 +08:00
parent 2cff827e3f
commit 1544de5562
6 changed files with 76 additions and 74 deletions

View File

@ -151,21 +151,22 @@ export class TicketService extends ShipperBaseService {
if (!url) {
return;
}
const uA = window.navigator.userAgent; // 判断浏览器内核
const isIE =
/msie\s|trident\/|edge\//i.test(uA) &&
!!('uniqueID' in document || 'documentMode' in document || 'ActiveXObject' in window || 'MSInputMethodContext' in window);
const objectUrl = url;
const a = document.createElement('a');
document.body.appendChild(a);
a.href = objectUrl;
a.download = '面单.pdf';
if (isIE) {
// 兼容IE11无法触发下载的问题
(navigator as any).msSaveBlob(url, a.download);
} else {
a.click();
}
a.remove();
this.openURL(url);
// const uA = window.navigator.userAgent; // 判断浏览器内核
// const isIE =
// /msie\s|trident\/|edge\//i.test(uA) &&
// !!('uniqueID' in document || 'documentMode' in document || 'ActiveXObject' in window || 'MSInputMethodContext' in window);
// const objectUrl = url;
// const a = document.createElement('a');
// document.body.appendChild(a);
// a.href = objectUrl;
// a.download = '面单.pdf';
// if (isIE) {
// // 兼容IE11无法触发下载的问题
// (navigator as any).msSaveBlob(url, a.download);
// } else {
// a.click();
// }
// a.remove();
}
}