@esmx/router-vue
Version:
Vue integration for @esmx/router - A universal router that works seamlessly with both Vue 2.7+ and Vue 3
62 lines (61 loc) • 1.34 kB
TypeScript
/**
* Vue plugin for \@esmx/router integration.
* Registers RouterLink and RouterView components globally.
* Compatible with both Vue 2.7+ and Vue 3.
*
* @example
*
* Vue 3 installation
*
* ```typescript
* import { createApp } from 'vue';
* import { Router } from '@esmx/router';
* import { RouterPlugin, useProvideRouter } from '@esmx/router-vue';
*
* const routes = [
* { path: '/', component: Home },
* { path: '/about', component: About }
* ];
*
* const router = new Router({ routes });
* const app = createApp({
* setup() {
* useProvideRouter(router);
* }
* });
*
* app.use(RouterPlugin);
* app.mount('#app');
* ```
*
* @example
*
* Vue 2 installation
*
* ```typescript
* import Vue from 'vue';
* import { Router } from '@esmx/router';
* import { RouterPlugin, useProvideRouter } from '@esmx/router-vue';
*
* const routes = [
* { path: '/', component: Home },
* { path: '/about', component: About }
* ];
*
* const router = new Router({ routes });
* Vue.use(RouterPlugin);
*
* new Vue({
* setup() {
* useProvideRouter(router);
* }
* }).$mount('#app');
* ```
*/
export declare const RouterPlugin: {
/**
* Install the router plugin.
* @param app Vue application instance (Vue 3) or Vue constructor (Vue 2)
*/
install(app: unknown): void;
};