一.query路由传值
this.$router.push({path:'./footDetail',query:{posterFotDetail}})
取值:
mounted:function(){
console.log(this.$route.query.posterFotDetail)
}
一.params路由传值
this.$route.push({
name:'home',
path:'/home',
params: {
message: "",
data: {}
}
})
或者声明式:
:to="{name:'planDetail',params:{data:item}}"
取值:
let data = this.$route.params.data;
注意:
1.query后边传递的东西带括号
2.query传值在浏览器地址栏传递数据可见,params不可见
3.接收数据必须在页面加载完成后(mounted而不是created)
1.query传递的数据在页面刷新后能够保留,params不行