From ef9cf2de8c98aaf988463aa0a0e8c6e7c7ec5dec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BE=9D=E7=91=AA=E8=B2=93?= Date: Sun, 8 Mar 2026 11:55:06 +0800 Subject: [PATCH] Migrate router type augmentation to Vue 3 runtime core Co-Authored-By: Codex --- src/types/vue-router.d.ts | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/src/types/vue-router.d.ts b/src/types/vue-router.d.ts index 87b0d8c..e759cf6 100644 --- a/src/types/vue-router.d.ts +++ b/src/types/vue-router.d.ts @@ -4,26 +4,19 @@ // cindy.chang@dsp.im (Cindy Chang), 2024/7/9 /** * @module types/vue-router.d - * Vue Router type augmentation for the Vue - * instance $router and $route properties. + * Vue 3 component instance type augmentation for + * `$router` and `$route` properties. */ -import { Router, RouteLocationNormalized } from 'vue-router'; +import type { Router, RouteLocationNormalizedLoaded } from 'vue-router'; -/** Augments the Vue instance with router properties. */ -declare module 'vue/types/vue' { - /** Vue instance augmentation. */ - interface Vue { +/** Augments Vue 3 component instance properties with router types. */ +declare module '@vue/runtime-core' { + /** Component custom property augmentation. */ + interface ComponentCustomProperties { /** The Vue Router instance. */ $router: Router; /** The current normalized route location. */ - $route: RouteLocationNormalized; + $route: RouteLocationNormalizedLoaded; } } - -// declare module '@router' { -// import { Router } from 'vue-router'; -// const router: Router; -// export default router; -// } - \ No newline at end of file