edit
This commit is contained in:
@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user