Nested views, in vue-router, are greats!
I have a few of links point to them just like:
<router-link :to="'/club/'+team.id_team+'/players'">Players</router-link>
If you know vue-router you will see here the path items:
- "club" is the router path, his name in the router is "team";
- team.id_team is the params teamId
- "players" is the children path (which has the same name: "players"
It works nice but I prefer to write my code in :to tag as JSON data but I'm not able using it with nested view.
This is the form I like to use:
:to="{name:'team',params: {teamId:team.serie_id}}"
And this is the router:
{ path: '/club/:teamId',
name:'team',
component: team,
children :[
{
name:'players',
path: 'players',
component: teamPlayers,
},
{
name:'staff',
path: 'staff',
component: teamStaff,
params: true,
},
{
name:'table',
path: 'table',
component: teamTable,
params: true,
}
]},
How to update this last line to use the nested view?
team
toplayers
in your router link – Rich:to="{ name: 'players', params: { teamId: team.serie_id } }"
? – Rich