API Reference | Vue Router - Your Complete Routing Toolkit 🔧
Master every feature - From basic navigation to advanced routing patterns!
Welcome to the ultimate Vue Router API reference! This comprehensive guide gives you complete control over routing in your Vue.js applications. Whether you're building a simple blog or a complex enterprise application, you'll find exactly what you need here. 🎯
🚀 Core API Overview
Vue Router offers a powerful yet intuitive API surface that scales from simple use cases to complex routing scenarios. Discover the tools that make modern web navigation a breeze!
Router Creation Functions
- createRouter() - Main entry point for creating a router instance
- createWebHistory() - Creates standard HTML5 history mode
- createWebHashHistory() - Creates hash-based history for static deployments
- createMemoryHistory() - Creates in-memory history for SSR and testing
Navigation Functions
- useRouter() - Access router instance for programmatic navigation
- useRoute() - Access current route information and watch for changes
- onBeforeRouteLeave() - Guard hook triggered before leaving the current route
- onBeforeRouteUpdate() - Guard hook triggered when the current route updates
Core Components
- RouterView - Component that renders the matched component for the current route
- RouterLink - Component for declarative navigation with smart behavior
📚 API Categories
Enumerations
Detailed enumeration types for navigation failures and error codes, helping you precisely handle routing exceptions.
Interfaces
Comprehensive interface definitions that describe the structure of route data, parameters, and configuration objects.
Type Aliases
TypeScript type aliases that provide type safety and better developer experience when working with Vue Router.
Variables
Important global variables and constants that facilitate routing development and testing.
Functions
Utility functions for navigation, route matching, query parsing, and other routing operations.
Each API entry includes detailed descriptions, parameter lists, return types, and practical usage examples. Use the navigation sidebar to explore specific APIs!
💡 Tip: We recommend reading the Guide documentation first to understand core concepts before diving into specific API details.