gitmyhub

vue-router

JavaScript ★ 19k updated 2mo ago

🚦 The official router for Vue 2

The official URL routing library for Vue 2 that lets you build multi-screen web apps with fast, in-page navigation instead of full page reloads.

JavaScriptVue.jssetup: easycomplexity 2/5

vue-router is the official routing library for Vue 2, the JavaScript framework for building web interfaces. Routing, in web development terms, means handling navigation — deciding which page or component to display when a user clicks a link or types a URL. Without a router, a web app would only show one screen and couldn't navigate between sections without doing a full page reload.

vue-router enables Single Page Applications (SPAs) — where the browser loads the app once and then swaps out content dynamically as the user navigates, giving a fast, app-like experience. It supports nested routes (a page within a page, like a settings panel with sub-tabs), route parameters (dynamic segments in URLs like /user/123), and query strings. It also provides animated transitions between views using Vue's built-in transition system, and navigation guards for controlling access (like blocking unauthenticated users from certain pages).

You would use this whenever you're building a Vue 2 web application that has multiple distinct screens or sections that users can navigate between. It handles both HTML5 history mode (clean URLs like /about) and hash mode (URLs like /#/about) with automatic fallback for older browsers. It's written in JavaScript and is maintained by the Vue.js team.

Where it fits