fix(projects): not only /login claim dynamic path scenario , but also others , eg:/user/1

This commit is contained in:
sunhao1256 2023-02-13 16:57:54 +08:00
parent 3503dff663
commit 6059891556
2 changed files with 4 additions and 4 deletions

View File

@ -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'>;
/** 需要登录权限 */
@ -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;

View File

@ -1,5 +1,5 @@
import 'vue-router';
declare module 'vue-router' {
interface RouteMeta extends AuthRoute.RouteMeta {}
interface RouteMeta extends AuthRoute.RouteMeta<AuthRoute.RoutePath> {}
}