from your code, you use vue-cli, but why do you write all this in router/index.js?
isn't this the code you should write to import vue.js?
suppose you are using vue-cli, then your third-level component can be directly packaged into a separate component and imported into the secondary component, ha (the secondary component is imported by the first-level component)
can you understand what I mean? Then how do you realize the reuse of components when you use it this way, which is not in line with the core idea of vue-cli?
if you implement this way
Vue three-level routing nesting example
or you ide/essentials/nested-routes.html" rel= "nofollow noreferrer" > nested routing official documentation
why don't you try this?
children : [
{
path: 'childAccount',
name: 'childAccount',
meta: {
icon:'ios-people',
title: ''
},
component:() => import ('@/views/user-center'),
},
{path:'/', redirect: 'childAccount'}
]
make sure your path is right
see what error your console reported
{
path : '/home',
name : 'home',
component : Main,
meta : {
menu: true,
title: ''
},
children : [
{
path: 'account',
name: 'account',
redirect : '/home/account/childAccount',//
component: () => import ('@/views/user-center/child-account'),
meta: {
icon:'ios-switch',
title: ''
},
children : [
{
path: 'childAccount',
name: 'childAccount',
meta: {
icon:'ios-people',
title: ''
},
component:() => import ('@/views/user-center'),
}
]
}
]
}
is the redirection wrong? write it as redirect:'/ home/account/childAccount',
try
take a look at your console