1query
router-link跳转
<router-link :to="{path:'/',query:{id:321}}">注册reg</router-link>
用this.$route.query.id
接收
函数跳转
hh(){
this.$router.push({path:'/',query: {id: '5455'}})
console.log(1)
}
也用this.$route.query.id
接收
2.params
router-link跳转
<router-link :to="{name:'home',params:{id:s}}">注册reg</router-link>
用this.$route.params.id
接收
函数跳转
hh(){
this.$router.push({name:'home',params: {id: '5455'}})
console.log(1)
}
也用this.$route.params.id
接收
注意params传参用name