Default Child Views
Part of the Routing and State section of Coddy's Vue journey. Lesson 22 of 55.
An empty child path provides the default content for the parent location. The record below shows Dashboard when the location is exactly /account, inside AccountLayout.
{path:'/account',component:AccountLayout,children:[
{path:'',component:Dashboard},
{path:'settings',component:Settings}
]}The empty path adds no URL segment. It differs from a child named home, which adds /home to the parent path. A default child lets the layout always offer meaningful content at its own URL without redirecting to another location.
Challenge
MediumAt exactly /studio, show Overview.vue inside the studio layout using an empty child path. Keep the existing rooms and schedule children. Navigating from a child to the parent URL must show Studio overview without removing Studio workspace or resetting the parent visit counter.
Keep the supplied route readout and bootstrap files.
Try it yourself
<!doctype html><html><head><meta charset="UTF-8"><title>Routing practice</title></head><body><div id="app"></div><script type="module" src="./main.js"></script></body></html>This lesson includes a short quiz. Start the lesson to answer it and track your progress.
All lessons in Routing and State
4Query State
Reading Query ValuesCommitting Search QueriesPreserving Other FiltersNormalizing Query NumbersRecap: Catalog Filters2Navigation Actions
Navigation from HandlersReplacing HistoryHistory TravelCurrent Navigation LinksRecap: Save and Review5Nested Layouts
Parent and Child OutletsDefault Child ViewsRelative Child PathsAncestor Navigation StateRecap: Library Workspace8Store Design
Setup Store StructurePatching Related StateResetting Store StateComposing Related StoresRecap: Trip Pack11Workshop Planner Project
Planner RoutesShared Reservations