Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

256
Vistas
Vue children route

I was looking a way to make my static blog development more faster using vue-router, but I found a problem linking the children pages with the parent route.


    const routes = [
      {
        path: '/',
        name: 'Home',
        component: Home
      },
      {
        path: '/about', name: 'About', component: About,
        children: [
          { 
            path: '/test', name: 'How test children link', component: prova }
        ]
    
      }
    ]

If I try to go on localhost/about/test address Vue can't find the page, but I can reach it if I go directly to localhost/test.

If I change the children path to

    path: '/about/test', name: 'How test children link', component: prova }

It works, but, I don't understand the utility of the child route.

What I don't understand about children route?

over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

You are on the right track. But you have to keep in mind that / means, and does, something.

const routes = [
  {
    path: '/',
    name: 'Home',
    component: Home
  },
  {
    path: '/about', name: 'About', component: About,
    children: [
      { 
        path: 'test', name: 'AboutChild', component: TestComponent 
      }
    ]
  }
]

So basically do NOT include a / when adding a path for children. And if you do, add the whole path so in this case: path: '/about/test'

And equally as important, you won't see the contents of AboutChild until you had a html tag called <router-view /> in the About component.

over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda