← Vue.js learning pathVue.js · Module 7 of 10
Vue Router
Create multi-page apps with client-side routing.
📖 Key ideas
- Define routes: { path: "/about", component: About }.
- <RouterView /> shows the matched page.
- <RouterLink to="/about"> navigates.
- Dynamic routes: /users/:id, read with useRoute().params.id.
- Navigation guards (beforeEach) handle login checks.
💡 Real-life example: Vue Router is a lift: press a floor number (URL) and it opens the right floor (component).
RouterViewWhere matched component renders
RouterLinkNavigation link
useRouteReads current route info
beforeEachGlobal navigation guard