RouterPlugin
Introduction
@esmx/router-vue provides Vue integration for @esmx/router, offering a plugin, composables, and components for seamless routing in Vue 2.7+ and Vue 3 applications. The RouterPlugin is the entry point for registering the router with your Vue application.
Type Definition
Vue plugin that registers RouterLink and RouterView as global components and sets up $router and $route properties on Vue instances.
Installation
Vue 3
Vue 2
Behavior
When installed, the plugin performs the following:
- Registers global components:
RouterLinkandRouterViewbecome available in all templates without explicit importing - Sets up instance properties: Configures
$routerand$routeas reactive properties accessible viathis.$routerandthis.$routein Options API - Vue 2 compatibility: Automatically detects the Vue version and applies the appropriate setup mechanism (prototype augmentation for Vue 2,
globalPropertiesfor Vue 3)