方法一:缺陷:打开的新链接非同源时,不生效
const newWindow = window.open(url)
newWindow.onload = () => {
newWindow.document.title = fileInfo.appendixName
}
方法二 缺陷:h5的android端不支持
openWindow (url, title) {
const newWindow = window.open('about:blank', title);
newWindow.document.title = title;
let iframe = document.createElement('iframe');
iframe.src = url;
iframe.style.width = '100%';
iframe.style.height = '100vh';
iframe.style.margin = '0';
iframe.style.padding = '0';
iframe.style.overflow = 'hidden';
iframe.style.border = 'none';
newWindow.document.body.style.margin = '0';
newWindow.document.body.appendChild(iframe);
},
this.openWindow(url, title)