I have a routing:
{
path: '/user',
name: 'user',
component: () => import('@/views/users/Users.vue'),
children: [
{
path: '/:id/:username?',
name: 'userData',
component: () => import('@/components/users/User.vue'),
},
],
},
My setting router:
const router = new VueRouter({
mode: 'history',
base: process.env.BASE_URL,
scrollBehavior: () => ({ y: 0 }),
});
I have a problem with child element in route. When I go to the site http://localhost:8080/user
I see list with all user from databse. But when i go to the site: http://localhost:8080/user/1/john
vue loads view again with all user (view Users.vue
), here I need load component with data of one user (component User.vue
). Parameter username
is optinal.