1、this.$route.query:
(1) 传参:
this.$router.push({
path: '/xxx',
query:{
id:id
}
})
(2) 获取参数:
this.$route.query.id
(3) 在 url 中形式(url 中带参数):
http://xxx?id=1,刷新跳转后传参的页面,数据还会存在
2、this.$route.params:
(1) 传参:
this.$router.push({
name: 'xxx',
params:{
id:id
}
})
(2) 获取参数:
this.$route.params.id
(3) 在 url 中形式(url 中不带参数):
http://xxx,刷新跳转后传参的页面,数据不存在