本文主要介绍VUE2.0参数的传递与接收
一、传参
this.$route.push({path:'/xxx',query:{id:1}});//类似get传参,通过URL传递参数
this.$route.push({path:'/xxx',params:{id:1}});//类似post传参
二、接收
mounted(){
this.$route.query.id
this.$route.params.id
},
注:笔者主要使用的是第二种方式类似post的方式进行传值的,使用第一种需要传递JSON数组的时候,有可能受字段长度影响,包数据不齐全。