Skip to content

Vue Nested Routes

Nested routes render child routes inside a parent's RouterView. This lesson covers practical patterns, syntax, and mistakes to avoid.

Nested Views

Nested routes render child routes inside a parent's RouterView.

Perfect for layouts with sidebars and tabs.

{ path: '/settings', component: SettingsLayout, children: [
  { path: '', component: Profile },
  { path: 'billing', component: Billing },
]}

Settings layout with default + billing child.

Empty Path Child

path: '' is the default child.
  • Prefer Composition API + script setup.
  • Use computed for derived UI.
  • Keep side effects intentional.
  • Practice in a small Vite app.

Vue Nested Routes Cheatsheet

Quick reference for patterns covered in this lesson.

Item Example Purpose
RouterView nested outlet UI
children tree Config
default child empty path Index
named views multiple outlets Advanced
relative links router-link Nav
meta merge parent+child Guards

Layouts

One parent layout reduces chrome duplication.

Common Mistakes

  • Forgetting nested RouterView.
  • Absolute child paths accidentally escaping layout.

Key Takeaways

  • Vue Nested Routes is important in Vue apps.
  • Practice in SFCs.
  • Prefer clear naming.
  • Check Vue docs for details.

Pro Tip

Sketch the URL tree before coding nested views.