1.this.$route.query的使用
1、传参数:
this.$router.push({
path: '/app',
query:{
id:id,
}
})
2、获取参数:
this.$route.query.id
3、在url中形式(url中带参数)
http://localhost:8080/#/app?id=1
4、页面之间用路由跳转传参时,刷新跳转后传参的页面,数据还会显示存在
2.this.$route.params的使用
1、传参数:
this.$router.push({
name: 'app',
params:{
id:id,
}
})
2、获取参数:
this.$route.params.id
3、在url中形式(url中不带参数)
http://localhost:8080/#/app
4、页面之间用路由跳转传参时,刷新跳转后传参的页面,数据不存在