Answer the question
In order to leave comments, you need to log in
How to create a route group in vue-router?
Hello!
I can't figure out how to create a route group. I tried through children but it works through the parent router-view i.e. not through the very first router-view, but descends from parent to child, etc., as I understand it.
I need this to set one meta per route group.
those. I want so:
{
path:"/admin",
name: 'Admin',
meta:{isAdmin:true},
component: () => import('./views/admin/Main.vue'),
children:[
{
path:'user',
name:'allUsers',
component: () => import('./views/admin/User/allUsers.vue'),
},
{
path:'products',
name:'allProducts',
component: () => import('./views/admin/Products/allProducts.vue'),
},
]
},
{
path:"/admin",
name: 'Admin',
meta:{isAdmin:true},
component: () => import('./views/admin/Main.vue'),
},
{
path:'/admin/user',
name:'allUsers',
meta:{isAdmin:true},
component: () => import('./views/admin/User/allUsers.vue'),
},
{
path:'/admin/products',
name:'allProducts',
meta:{isAdmin:true},
component: () => import('./views/admin/Products/allProducts.vue'),
},
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question