I have some simple CRUD pages for users (and use Vuetify). So
- /users will render the users list
- /users/:id will render the user profile
After setting up my nested routes in the router config I'm navigating to those nested routes but my currently rendered view doesn't update although the browser url gets updated. Steps to reproduce:
- Create a new Vue project with Vue Router
- Add Vuetify to the project
- Update the App.vue file to
.
<template>
<v-app>
<router-view></router-view>
</v-app>
</template>
- Create a users view
.
<template>
<v-btn to="/users/1">Navigate</v-btn>
</template>
- Create a user view
.
<template>
<p>User</p>
</template>
- Setup the routes
.
const routes = [
{
path: "/",
redirect: "/users"
},
{
path: "/users",
component: Users,
children: [
{
path: ":id",
component: User
}
]
}
];
- Run the application and call the root url (
http://localhost:8080) - You should get redirected to
/users - Click the button
- The url gets updated but the application won't navigate to the user view
How can I fix that? I would expect a rendered user view for http://localhost:8080/users/1