Skip to content

Commit

Permalink
Merge pull request #180 from sunhao1256/main
Browse files Browse the repository at this point in the history
fix(projects): not only `/login` claim dynamic path scenario
  • Loading branch information
honghuangdc committed Feb 14, 2023
2 parents 3503dff + 6059891 commit 960b436
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> {}
}

1 comment on commit 960b436

@vercel
Copy link

@vercel vercel bot commented on 960b436 Feb 14, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.