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') }
上面是“vue项目中实现链接跳转几种方法(打开新页面)”的全面内容,想了解更多关于 vuejs 内容,请继续关注web建站教程。
当前网址:https://ipkd.cn/webs_2904.html
workflows工作流
一座生动的点彩主义灯塔ComfyUI工作流
一个外国人在吹奏萨克斯ComfyUI工作流
一桌精致的美食,桌上几杯白葡萄酒
一只可爱的猫骑着一匹可爱的马ComfyUI工作流
一只由粉色水晶与羽毛组成的巨型高跟鞋
一座古老的石阶,旁边有一棵树
一个破旧的工厂,一个骷髅雕像
城市里出现一只可爱的小生物ComfyUI工作流
猜你喜欢
声明:本站提供的所有资源部分来自互联网,如果有侵犯您的版权或其他权益,请发送到邮箱:admin@ipkd.cn,我们会在看到邮件的第一时间内为您处理!