Skip to content

Commit

Permalink
fix(types): fix routing type error #145
Browse files Browse the repository at this point in the history
  • Loading branch information
anncwb committed Dec 23, 2020
1 parent 7db0c5c commit b6e5c3f
Show file tree
Hide file tree
Showing 14 changed files with 20 additions and 13 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.zh_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
- 修复环境变量配置失效以及 history 模式下 logo 地址问题
- 修复图表库切换页面导致宽高计算错误
- 修复多语言配置 `Locale.show`导致配置不生效
- 修复路由类型错误

## 2.0.0-rc.14 (2020-12-15)

Expand Down
5 changes: 4 additions & 1 deletion src/components/types.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
import { defineComponent } from 'vue';

export type Component = ReturnType<typeof defineComponent>;
export type Component<T extends any = any> =
| ReturnType<typeof defineComponent>
| (() => Promise<typeof import('*.vue')>)
| (() => Promise<T>);
2 changes: 1 addition & 1 deletion src/router/helper/menuHelper.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { AppRouteModule } from '/@/router/types.d';
import { AppRouteModule } from '/@/router/types';
import type { MenuModule, Menu, AppRouteRecordRaw } from '/@/router/types';

import { findPath, forEach, treeMap } from '/@/utils/helper/treeHelper';
Expand Down
2 changes: 1 addition & 1 deletion src/router/menus/modules/dashboard.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { MenuModule } from '/@/router/types.d';
import type { MenuModule } from '/@/router/types';
import { t } from '/@/hooks/web/useI18n';

const menu: MenuModule = {
Expand Down
2 changes: 1 addition & 1 deletion src/router/menus/modules/demo/charts.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { MenuModule } from '/@/router/types.d';
import type { MenuModule } from '/@/router/types';
import { t } from '/@/hooks/web/useI18n';

const menu: MenuModule = {
Expand Down
2 changes: 1 addition & 1 deletion src/router/menus/modules/demo/comp.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { MenuModule } from '/@/router/types.d';
import type { MenuModule } from '/@/router/types';
import { t } from '/@/hooks/web/useI18n';

const menu: MenuModule = {
Expand Down
2 changes: 1 addition & 1 deletion src/router/menus/modules/demo/excel.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { MenuModule } from '/@/router/types.d';
import type { MenuModule } from '/@/router/types';
import { t } from '/@/hooks/web/useI18n';

const menu: MenuModule = {
Expand Down
2 changes: 1 addition & 1 deletion src/router/menus/modules/demo/feat.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { MenuModule } from '/@/router/types.d';
import type { MenuModule } from '/@/router/types';
import { t } from '/@/hooks/web/useI18n';

const menu: MenuModule = {
Expand Down
2 changes: 1 addition & 1 deletion src/router/menus/modules/demo/iframe.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { MenuModule } from '/@/router/types.d';
import type { MenuModule } from '/@/router/types';
import { t } from '/@/hooks/web/useI18n';

const menu: MenuModule = {
Expand Down
2 changes: 1 addition & 1 deletion src/router/menus/modules/demo/level.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { MenuModule } from '/@/router/types.d';
import type { MenuModule } from '/@/router/types';
import { t } from '/@/hooks/web/useI18n';

const menu: MenuModule = {
Expand Down
2 changes: 1 addition & 1 deletion src/router/menus/modules/demo/page.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { MenuModule } from '/@/router/types.d';
import type { MenuModule } from '/@/router/types';
import { t } from '/@/hooks/web/useI18n';

const menu: MenuModule = {
Expand Down
2 changes: 1 addition & 1 deletion src/router/menus/modules/demo/permission.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { MenuModule } from '/@/router/types.d';
import type { MenuModule } from '/@/router/types';
import { t } from '/@/hooks/web/useI18n';

const menu: MenuModule = {
Expand Down
2 changes: 1 addition & 1 deletion src/router/menus/modules/home.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { MenuModule } from '/@/router/types.d';
import type { MenuModule } from '/@/router/types';
import { t } from '/@/hooks/web/useI18n';

const menu: MenuModule = {
Expand Down
5 changes: 4 additions & 1 deletion src/router/types.d.ts → src/router/types.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import type { RouteRecordRaw } from 'vue-router';
import { RoleEnum } from '/@/enums/roleEnum';
import Component from '/@/components/types';

import type { Component } from '/@/components/types';

export interface RouteMeta {
// title
title: string;
Expand Down Expand Up @@ -30,6 +32,7 @@ export interface RouteMeta {
single?: boolean;
}

// @ts-ignore
export interface AppRouteRecordRaw extends Omit<RouteRecordRaw, 'meta'> {
name: string;
meta: RouteMeta;
Expand Down

0 comments on commit b6e5c3f

Please sign in to comment.