Vue 点击事件打开新窗口跳转页面 - 示例代码
在 Vue 中,你可以使用``标签来创建一个链接,并通过绑定`href`属性来设置跳转的地址。在点击事件中,你可以使用`window.open`方法来在新窗口中打开链接。
下面是一个示例代码:
<template>
<div>
<button @click='openNewPage'>跳转到别人的页面</button>
</div>
</template>
<script>
export default {
methods: {
openNewPage() {
const url = 'http://192.168.50.101:8088/cdmsA/index.html';
window.open(url, '_blank');
}
}
}
</script>
当点击按钮时,会在新窗口中打开指定的链接地址。
原文地址: https://www.cveoy.top/t/topic/pi7F 著作权归作者所有。请勿转载和采集!