vue中路由的跳转和参数传递---route.param获取不到

我从A组件跳转到B组件,并通过路由信息对象传递一些参数

this.$router.push({
 path: '/b',
 params: {
  paramA: 'a'
 },
 query:{
  paramB: 'b'
 }
})

在B组件中获取参数
this. r o u t e . q u e r y . p a r a m B / / b t h i s . route.query.paramB //b this. route.params.paramA //undefined
说明:路由的params对象使用,必须要通过路由名来调用路由,而不同通过path来调用,而query对象则没有这个要求。

猜你喜欢

转载自blog.csdn.net/lovexiaobaby/article/details/93618297