[Vuejs]-Vue Router – Same path, but different components

0👍

With the OptionB the child component should be inside the parent path’s component with <router-view/>.

So the OptionB is wrong.

What you want is a default child component:

import {RouterView} from 'vue-router';

const routes = [
  {
    path: '/users',
    component: RouterView,
    children: [
      {
        path: '',
        component: User
      },
      {
        path: 'user-reference',
        component: UserReference
      }
    ]
  }
];

Leave a comment