我从A组件跳转到B组件,并通过路由信息对象传递一些参数
this.$router.push({
path: '/b',
params: {
paramA: 'a'
},
query:{
paramB: 'b'
}
})
在B组件中获取参数
this.
route.params.paramA //undefined
说明:路由的params对象使用,必须要通过路由名来调用路由,而不同通过path来调用,而query对象则没有这个要求。
我从A组件跳转到B组件,并通过路由信息对象传递一些参数
this.$router.push({
path: '/b',
params: {
paramA: 'a'
},
query:{
paramB: 'b'
}
})
在B组件中获取参数
this.
route.params.paramA //undefined
说明:路由的params对象使用,必须要通过路由名来调用路由,而不同通过path来调用,而query对象则没有这个要求。