VueRouter

路由跳转

路由跳转的方式有两种,一种根据name进行隐式的params传递,另一种是根据path路径进行的显式query传递。

1、name跳转页面

this.$router.push({name:'anotherPage',params:{id:1}});
this.$route.params.id

2、path跳转页面

path跳转会将参数显示到url上。

this.$router.push({path:'/anotherPage',query:{id:1}});
this.$route.query.id
Last Updated:
Contributors: Jkevin