3👍
✅
route.js
[
path: '/', redirect: '/main/mainchild1',
path: '/main', redirect: '/main/mainchild1', component: 'main.vue', children: [
{ path: '/main/mainchild1', component: mainchild1.vue },
{ path: '/main/mainchild2', component: mainchild2.vue }
]
]
app.vue
<template>
<sidebar v-if="isLoggedIn"/>
<router-view></router-view> <!-- components mapped with route '/' or '/main' will render here -->
</template>
main.vue
<template>
<router-view></router-view> <!-- components mapped with route '/main/mainchild1' or '/main/mainchild2' will render here -->
</template>
Source:stackexchange.com