I attempted to nest my routes using Vue router, but encountered some difficulties
{
path: '/admin',
name: 'Admin', component: () => import('pages/Admin'),
children:[
{ path: 'stock', name: 'Stock', component:()=> import('pages/Stock')},
]},
After some troubleshooting, I discovered that I needed to place <router-view>
inside the parent component for it to work properly.
However, when I try to load the page /admin/stock, both components are rendered on top of each other. Why does the parent component (/admin page) still display?
It's worth noting that without nesting the routes, everything worked perfectly fine and the components rendered separately (as shown below).
{
path: '/admin',
name: 'Admin', component: () => import('pages/Admin'),
children:[
//no nested route
]},
{ path: 'admin/stock', name: 'Stock', component: ()=> import('../pages/Stock')},
Thank you for your assistance