Commit b6e5c3f625f3e30b1fa7433e57b1294a8ce8d04b
1 parent
7db0c5c4
fix(types): fix routing type error #145
Showing
14 changed files
with
20 additions
and
13 deletions
CHANGELOG.zh_CN.md
@@ -12,6 +12,7 @@ | @@ -12,6 +12,7 @@ | ||
12 | - 修复环境变量配置失效以及 history 模式下 logo 地址问题 | 12 | - 修复环境变量配置失效以及 history 模式下 logo 地址问题 |
13 | - 修复图表库切换页面导致宽高计算错误 | 13 | - 修复图表库切换页面导致宽高计算错误 |
14 | - 修复多语言配置 `Locale.show`导致配置不生效 | 14 | - 修复多语言配置 `Locale.show`导致配置不生效 |
15 | +- 修复路由类型错误 | ||
15 | 16 | ||
16 | ## 2.0.0-rc.14 (2020-12-15) | 17 | ## 2.0.0-rc.14 (2020-12-15) |
17 | 18 |
src/components/types.ts
1 | import { defineComponent } from 'vue'; | 1 | import { defineComponent } from 'vue'; |
2 | 2 | ||
3 | -export type Component = ReturnType<typeof defineComponent>; | 3 | +export type Component<T extends any = any> = |
4 | + | ReturnType<typeof defineComponent> | ||
5 | + | (() => Promise<typeof import('*.vue')>) | ||
6 | + | (() => Promise<T>); |
src/router/helper/menuHelper.ts
1 | -import { AppRouteModule } from '/@/router/types.d'; | 1 | +import { AppRouteModule } from '/@/router/types'; |
2 | import type { MenuModule, Menu, AppRouteRecordRaw } from '/@/router/types'; | 2 | import type { MenuModule, Menu, AppRouteRecordRaw } from '/@/router/types'; |
3 | 3 | ||
4 | import { findPath, forEach, treeMap } from '/@/utils/helper/treeHelper'; | 4 | import { findPath, forEach, treeMap } from '/@/utils/helper/treeHelper'; |
src/router/menus/modules/dashboard.ts
src/router/menus/modules/demo/charts.ts
src/router/menus/modules/demo/comp.ts
src/router/menus/modules/demo/excel.ts
src/router/menus/modules/demo/feat.ts
src/router/menus/modules/demo/iframe.ts
src/router/menus/modules/demo/level.ts
src/router/menus/modules/demo/page.ts
src/router/menus/modules/demo/permission.ts
src/router/menus/modules/home.ts
src/router/types.d.ts renamed to src/router/types.ts
1 | import type { RouteRecordRaw } from 'vue-router'; | 1 | import type { RouteRecordRaw } from 'vue-router'; |
2 | import { RoleEnum } from '/@/enums/roleEnum'; | 2 | import { RoleEnum } from '/@/enums/roleEnum'; |
3 | -import Component from '/@/components/types'; | 3 | + |
4 | +import type { Component } from '/@/components/types'; | ||
5 | + | ||
4 | export interface RouteMeta { | 6 | export interface RouteMeta { |
5 | // title | 7 | // title |
6 | title: string; | 8 | title: string; |
@@ -30,6 +32,7 @@ export interface RouteMeta { | @@ -30,6 +32,7 @@ export interface RouteMeta { | ||
30 | single?: boolean; | 32 | single?: boolean; |
31 | } | 33 | } |
32 | 34 | ||
35 | +// @ts-ignore | ||
33 | export interface AppRouteRecordRaw extends Omit<RouteRecordRaw, 'meta'> { | 36 | export interface AppRouteRecordRaw extends Omit<RouteRecordRaw, 'meta'> { |
34 | name: string; | 37 | name: string; |
35 | meta: RouteMeta; | 38 | meta: RouteMeta; |