Vue中实现路由跳转的方式有:1.通过router-link标签跳转;2.通过this.$router.push()事件跳转;3.通过this.$router.Go(n)事件跳转;vue中实现路由跳转的方式有以下几种通过router-lin
Vue中实现路由跳转的方式有:1.通过router-link标签跳转;2.通过this.$router.push()事件跳转;3.通过this.$router.Go(n)事件跳转;
vue中实现路由跳转的方式有以下几种
通过router-link标签跳转
// 配置路由path: '/user/:id'
<router-link :to="'/user/' + this.id"> <router-link/>
// 接收参数
this.$route.params.id
通过this.$router.push()事件跳转
1)跳转字符串
this.$router.push('/home')
2)跳转对象
this.$router.push({path:'/home'})
通过this.$router.go(n)事件跳转
this.$router.go(1)// 后退一步记录
this.$router.go(-1)
// 前进三步记录
this.$router.go(3)
--结束END--
本文标题: vue中路由跳转的方式有哪些
本文链接: https://www.lsjlt.com/news/111714.html(转载时请注明来源链接)
有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341
下载Word文档到电脑,方便收藏和打印~
2024-05-16
2024-05-16
2024-05-16
2024-05-16
2024-05-16
2024-05-16
2024-05-16
2024-05-16
2024-05-16
2024-05-16
回答
回答
回答
回答
回答
回答
回答
回答
回答
回答
0