params方式:
//index.js
routes = [
{
path:'/user/:userId',
component:User
}
]
//App.vue
<router-link :to="'/user/' + userId">用户</router-link>
//获取path中的信息
this.$route.params.userId
query方式:
//index.js
routes = [
{
path:'/use',
component:User
}
]
//App.vue
<router-link :to={path:'/user',query:{userId:'11',name'lihua'}>用户</router-link>
//获取path中的信息
this.$route.query.userId