feat: 1. 修改完善全局路由检测。 2. 完善统一的token认证管理,token失效自动跳转到登录页。
This commit is contained in:
@@ -17,6 +17,7 @@ interface PreviousRouteData {
|
||||
|
||||
interface Handle {
|
||||
breadcrumb: string | ((data: unknown) => string);
|
||||
to?: string; // 自定义面包屑链接
|
||||
previousRoute?: PreviousRouteData | ((data: unknown) => PreviousRouteData | undefined);
|
||||
breadcrumbClassName?: string;
|
||||
}
|
||||
@@ -36,10 +37,10 @@ export function Breadcrumb({ items = [], className = '' }: BreadcrumbProps) {
|
||||
.map((match, index, array) => {
|
||||
// 当前路由的面包屑
|
||||
const current = {
|
||||
title: typeof match.handle?.breadcrumb === 'function'
|
||||
title: typeof match.handle?.breadcrumb === 'function'
|
||||
? match.handle.breadcrumb(match.data)
|
||||
: match.handle?.breadcrumb as string,
|
||||
to: match.pathname
|
||||
to: match.handle?.to || match.pathname // 优先使用 handle.to,否则使用 pathname
|
||||
};
|
||||
|
||||
// 如果当前路由有previousRoute属性且该路由是数组中的最后一个
|
||||
|
||||
Reference in New Issue
Block a user