在Vue中实现路由跳转的方法有:1.使用this.$router.push()跳转;2.使用router-link跳转;在vue中实现路由跳转的方法有以下几种使用this.$router.push()跳转1)不带参跳转this.$route
在Vue中实现路由跳转的方法有:1.使用this.$router.push()跳转;2.使用router-link跳转;
在vue中实现路由跳转的方法有以下几种
使用this.$router.push()跳转
1)不带参跳转
this.$router.push('/home')
this.$router.push({name:'home'})
this.$router.push({path:'/home'})
2)带参跳转
this.$router.push({name:'home',query: {id:'1'}})
this.$router.push({path:'/home',query: {id:'1'}})
this.$router.push({name:'home',params: {id:'1'}})
使用router-link跳转
1)不带参跳转
<router-link :to="{name:'home'}"> <router-link :to="{path:'/home'}">
2)带参跳转
<router-link :to="{name:'home', params: {id:1}}">
<router-link :to="{name:'home', query: {id:1}}">
--结束END--
本文标题: vue如何路由跳转
本文链接: https://www.lsjlt.com/news/110707.html(转载时请注明来源链接)
有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341
下载Word文档到电脑,方便收藏和打印~
2024-05-14
2024-05-14
2024-05-14
2024-05-14
2024-05-14
2024-05-14
2024-05-14
2024-05-14
2024-05-14
2024-05-14
回答
回答
回答
回答
回答
回答
回答
回答
回答
回答
0