直接看代码:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | const win = window.open(routeData.href, this.windowTitle); win.windowTitle = this.windowTitle; const loop = setInterval(function() { if (win.closed) { clearInterval(loop); } else { win.document.title = win.windowTitle; } }, 1000); 这种方式也是有弊端的 好的方式是url带上标题的参数(encodeURIComponent(this.windowTitle)) 在新开的页面mounted接收参数,给document.title设置参数。 document.title = decodeURIComponent(this.$route.query.windowTitle); |
web开发分享
声明: 本文由( zongyan86 )原创编译,转载请保留链接: window.open打开并修改名字