目录
一、使用字符串拼接
传:
this.$router.push("/about?id=18");
收:
this.$route.query.id
二、使用对象的形式:
第一种
query传参 路由后面拼接参数
传:
this.$router.push({
path:'/detail',
query: {
id: 1
}
)
收:
this.$route.query.id
第二种:
params传参,不会在路由后面拼接参数
传:
this.$router.push({
name: 'home',
params: {
id: 1
}
})
收:
this.$route.params.id