From bbcedd02baa053a88688a82fc72e87c857c82db2 Mon Sep 17 00:00:00 2001 From: dhb52 <dhb52@126.com> Date: 星期三, 03 一月 2024 11:40:39 +0800 Subject: [PATCH] fix: 修复vscode全局属性ts爆红问题 参照vuejs官方文档,[扩展全局属性](https://cn.vuejs.org/guide/typescript/options-api.html#augmenting-global-properties), --- src/types/router.d.ts | 63 ++++++++++++++++--------------- 1 files changed, 33 insertions(+), 30 deletions(-) diff --git a/src/types/router.d.ts b/src/types/router.d.ts index 07d177f..11a60a0 100644 --- a/src/types/router.d.ts +++ b/src/types/router.d.ts @@ -1,35 +1,38 @@ -import { RouteRecordRaw } from 'vue-router'; - +import { LocationQuery, type RouteMeta as VRouteMeta } from 'vue-router'; declare module 'vue-router' { - type RouteOption = { - hidden?: boolean; - permissions?: string[]; - roles?: string[]; - component?: any; - children?: RouteOption[]; - alwaysShow?: boolean; - parentPath?: string; - meta?: { - title: string; - icon: string; - }; - } & RouteRecordRaw; + interface RouteMeta extends VRouteMeta { + link?: string; + title?: string; + affix?: boolean; + noCache?: boolean; + activeMenu?: string; + icon?: string; + breadcrumb?: boolean; + } - interface _RouteLocationBase { - children?: RouteOption[]; - } + interface _RouteRecordBase { + hidden?: boolean | string | number; + permissions?: string[]; + roles?: string[]; + alwaysShow?: boolean; + query?: string; + parentPath?: string; + } - interface RouteLocationOptions { - fullPath?: string; - } + interface _RouteLocationBase { + children?: _RouteRecordBase[]; + path?: string; + title?: string; + } - interface TagView extends Partial<_RouteLocationBase> { - title?: string; - meta?: { - link?: string; - title?: string; - affix?: boolean; - noCache?: boolean; - }; - } + interface TagView { + fullPath?: string; + name?: string; + path?: string; + title?: string; + meta?: RouteMeta; + query?: LocationQuery; + } } + +export {}; -- Gitblit v1.9.3