标签:路径名 使用 代码 不能 求和 img param 没有 get
说明:路由的params对象使用,必须要通过路由名来调用路由,而不能通过path来调用,而query对象则没有这个要求。
1.query方式传参和接受参数
1 传参
2 this.$router.push({
3 path:‘/xxx‘
4 query:{
5 idname:id
6 }
7 })
接收的方式:this.$route.query.id
2.params方式传递参数
1 传参:
2 this.$router.push({
3 name:‘路径名称‘
4 query:{
5 idname:id
6 }
7 })
接收的方式:this.$route.params.id
3.query和params的区别,query相当于get请求,在页面跳转的时候,可以在地址栏看到请求参数,然而params则相当于post请求,参数不会在地址栏中显示。
query和params的区别,get请求和post请求!!
标签:路径名 使用 代码 不能 求和 img param 没有 get
原文地址:https://www.cnblogs.com/zwjun/p/11523505.html