js中跳转链接打开新窗口会用到window.open()
菜鸟解释很详细:
window.open
在需要进行点击跳转的位置设置点击事件:
<div class="btn-box">
<div class="btn-item" @click="toThirdUrl(0)">点击区域1</div>
<div class="btn-item" @click="toThirdUrl(2)">点击区域2/div>
<div class="btn-item" @click="toThirdUrl(1)">点击区域3</div>
</div>
toThirdUrl(index) {
window.open(window.globalData.thirdUrls[index] +
'?target=blank', '', 'fullscreen=no,width=1920,height=1080,top=0,left=0')
}
打开一个新的浏览器窗口,新页,不是打开一个新标签
此处跳转的链接地址是在config.js中设置的
const globalConfig = {
thirdUrls: [
'跳转链接0',
'跳转链接1',
'跳转链接2'
]
}
还有另外一种写法
toThirdUrl() {
let url = '链接地址'
window.open(`${url}?target=blank`,
'', 'fullscreen=no,width=1920,height=1080,top=0,left=0')
}