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://ipkd.cn/webs_2904.html
workflows工作流
乒乓卡通3d人物
一个威武雄壮的战士ComfyUI工作流
雪地里一只可爱的小老虎
泰坦尼克号桌面壁纸上ComfyUI工作流
一只处于战斗状态下的蚂蚁ComfyUI工作流
汗血宝马ComfyUI工作流
一只在森林里漫步的麋鹿ComfyUI工作流
一只蓬松柔软的圆形半鳄梨玩偶
猜你喜欢
声明:本站提供的所有资源部分来自互联网,如果有侵犯您的版权或其他权益,请发送到邮箱:admin@ipkd.cn,我们会在看到邮件的第一时间内为您处理!