[Vuejs]-Subroute is/ cannot be displayed

0👍

In the children array, you have to define a named path in order for it to render. In your case it should be something like this:


    const routes = [
      path: '/',
      component: () => import('../views/Main.vue'),
      children: [
        {
          path: 'home',
          name: 'home',
          component: () => import('../views/home/Home.vue')
        }
      ]
    ]

You’re basically creating children routes here which means if the parent route is '/', and the child route is 'home', the home component will be displayed on the path '/home'. In this route, '/' is the parent route and 'home' is the child component route.

Leave a comment