
vue项目中实现链接跳转有哪些方法,如何在新页面打开,下面web建站小编带大家了解一下实现代码!
// 直接写上跳转的地址
<router-link to="/index1">link跳转</router-link>
// 添加参数
<router-link :to="{path:'/index2', query:{id:1,name:'web'}}"></router-link>
// 新窗口打开
<router-link :to="{path:'/index3', query:{id:1,name:'web'}}" target="_blank"></router-link>
利用this.$router.replace跳转
toIndex (e) {
this.$router.replace({name: '/index', params: {id: e}})
}
利用this.$router.push跳转
toIndex (e) {
this.$router.push({name: "/index", params: {id: e}})
}
利用resolve跳转
toIndex (e) {
const new = this.$router.resolve({name: '/index', params: {id: e}})
window.open(new.href,'_blank')
}
标签: resolve, router-link, 链接跳转
上面是“vue项目中实现链接跳转几种方法(打开新页面)”的全面内容,想了解更多关于 vuejs 内容,请继续关注web建站教程。
当前网址:https://m.ipkd.cn/webs_2904.html
声明:本站提供的所有资源部分来自互联网,如果有侵犯您的版权或其他权益,请发送到邮箱:admin@ipkd.cn,我们会在看到邮件的第一时间内为您处理!

大圣盘平台特点介绍及官网入口,在线阿里云盘资源搜索工具
企业品牌移动端黄色模板(html+css+jquery)
浙里办开发兼容老年版需要使用无衬线字体
一款零门槛创作阿里巴巴旗下多风格AI绘画生成器——堆友AI反应堆
如何给网站增加百度推送功能增加网站收录
Best Teleprompter:免费在线提词神器,专业创作者的高效拍档