优化评查详情中用户操作的更新刷新为热更新
This commit is contained in:
@@ -18,6 +18,7 @@ interface PreviousRouteData {
|
||||
interface Handle {
|
||||
breadcrumb: string | ((data: unknown) => string);
|
||||
previousRoute?: PreviousRouteData | ((data: unknown) => PreviousRouteData | undefined);
|
||||
breadcrumbClassName?: string;
|
||||
}
|
||||
|
||||
interface Match {
|
||||
@@ -64,12 +65,22 @@ export function Breadcrumb({ items = [], className = '' }: BreadcrumbProps) {
|
||||
})
|
||||
.flat(); // 扁平化数组
|
||||
|
||||
// 获取自定义类名
|
||||
const getCustomClassName = () => {
|
||||
const lastMatch = matches[matches.length - 1];
|
||||
return lastMatch?.handle?.breadcrumbClassName || '';
|
||||
};
|
||||
|
||||
if (breadcrumbs.length === 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// 应用自定义类名
|
||||
const customClassName = getCustomClassName();
|
||||
const finalClassName = `mb-4 ${className} ${customClassName}`.trim();
|
||||
|
||||
return (
|
||||
<nav className={`mb-4 ${className}`} aria-label="面包屑导航">
|
||||
<nav className={finalClassName} aria-label="面包屑导航">
|
||||
<ol className="flex items-center space-x-2 text-sm text-gray-500">
|
||||
<li>
|
||||
<Link to="/" className="hover:text-primary-600 flex items-center">
|
||||
|
||||
Reference in New Issue
Block a user