[Vuejs]-Is it possible to use a variable at the end of "route.params." to catch several other "router.params"?

0👍

On the child component use:

  let info1 = this.$route.params;
  let info = info1[Object.keys(info1)[0]]

0👍

You can do this with Props.

In first parent component:

<SharedComponent :prop="$route.params.something"></SharedComponent>

In second parent component:

<SharedComponent :prop="$route.params.anothersomething"></SharedComponent>

In third parent:

<SharedComponent :prop="$route.params.yetanothersomething"></SharedComponent>

Leave a comment