Vue level 3 routes must be refreshed to display properly

problem description

vue level 3 routes must be refreshed to display properly

the environmental background of the problems and what methods you have tried

background management interface menu three-level child routing

related codes

only when loaded into the secondary directory, the third-level directory refresh can display normally

clipboard.png


clipboard.png


clipboard.png

clipboard.png

have any seniors ever met anyone who has filled this hole? Call for help!

Mar.02,2022

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
clipboard.png


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

Menu