1.通过name传值
fn(){
this.$router.push({
name:'My',
params: {
参数名: 参数值
}
})
}
接收 this.$route.params.参数名
-------------------------------------------
路由设置
{
path: '/my',
name:'My',
component:My
},
2.通过path
fn(){
this.$router.push({
path:'/my',
query:{
参数名:参数值
}
})
}
接收 this.$route.query.参数名
-------------------------------------------
路由设置
{
path: '/my',
name:'My',
component:My
},
3.拼接参数传参
{
path: '/my?参数名=参数值',
name:'My',
component:My
},
-------------------------------
this.$router.push('/my?xxx=值')
this.$router.push('/my/值')
接收 this.$route.query.xxx