I'm looking for a proper way to load a different VueJS component if there are any props included in a route.
For example, if I go to
/users
I get the users list page and if I'd go to
/users/1
I would go to user profile page.
I've been trying to add another route as a child with parameters but it wouldn't seem to help:
{
path: "users",
name: "users",
component: UsersList,
children: [
{
path: "users/:userId",
name: "User Profile",
component: UserProfile,
},
]
},
I am pushing the user profile route from a method like this:
this.$router.push({ path: 'users', name: 'User Profile', query: { userId: row.id }})
Any ideas?