Vue router priority

how can I directly access / render2 this route?

const routes = [{
  path: "/",
  redirect: "/index"
}, {
  path: "/index",
  component: Index,
  meta: { keepAlive: true },
  children: [{
    path: "/preview",
    component: PreView,
    children: [{
      path: "/render2",
      component: render2
    }]
  }]
}, {
  path: "/render2",
  component: render2
}]

because

is configured

`children: [{

]
  path: "/render2",
  component: render2
}]`

visited / preview/render2 every time

how can I access both / preview/render2
and / render2 directly?

Oct.11,2021

children: [{
      path: '/render2',
      component: render2
    }]
Change

to

children: [{
      path: 'render2',
      component: render2
    }]

add a name to the route:

{
  path: '/render2',
  name: 'Render2',
  component: render2
}
router.push({ name: 'Render2' })

you don't have to take'/'in the subpath. Try it like this.

children: [{
    path: 'preview',
    component: PreView,
    children: [{
      path: 'render2',
      component: render2
    }]
  }]
Menu