Skip to content

Commit

Permalink
fix(projects): not only /login claim dynamic path scenario , but al…
Browse files Browse the repository at this point in the history
…so others , eg:/user/1
  • Loading branch information
sunhao1256 committed Feb 13, 2023
1 parent 3503dff commit 6059891
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/typings/route.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ declare namespace AuthRoute {
type RouteComponentType = 'basic' | 'blank' | 'multi' | 'self';

/** 路由描述 */
interface RouteMeta {
interface RouteMeta<K extends AuthRoute.RoutePath> {
/** 路由标题(可用来作document.title或者菜单的名称) */
title: string;
/** 路由的动态路径(需要动态路径的页面需要将path添加进范型参数) */
dynamicPath?: AuthRouteUtils.GetDynamicPath<'/login'>;
dynamicPath?: AuthRouteUtils.GetDynamicPath<K>;
/** 作为单级路由的父级路由布局组件 */
singleLayout?: Extract<RouteComponentType, 'basic' | 'blank'>;
/** 需要登录权限 */
Expand Down Expand Up @@ -83,7 +83,7 @@ declare namespace AuthRoute {
/** 子路由 */
children?: Route[];
/** 路由描述 */
meta: RouteMeta;
meta: RouteMeta<RoutePath<K>>;
} & Omit<import('vue-router').RouteRecordRaw, 'name' | 'path' | 'redirect' | 'component' | 'children' | 'meta'>
: never;

Expand Down
2 changes: 1 addition & 1 deletion src/typings/router.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import 'vue-router';

declare module 'vue-router' {
interface RouteMeta extends AuthRoute.RouteMeta {}
interface RouteMeta extends AuthRoute.RouteMeta<AuthRoute.RoutePath> {}
}

0 comments on commit 6059891

Please sign in to comment.