mirror of
https://gitee.com/JavaLionLi/plus-ui.git
synced 2026-09-15 16:28:33 +08:00
update 优化 增加icon空的情况
This commit is contained in:
parent
eafce61dac
commit
565564a8a3
@ -15,7 +15,7 @@ export interface MenuForm {
|
|||||||
menuType?: 'M' | 'C' | 'F' | string;
|
menuType?: 'M' | 'C' | 'F' | string;
|
||||||
visible?: string;
|
visible?: string;
|
||||||
status?: string;
|
status?: string;
|
||||||
icon?: string;
|
icon?: string | null;
|
||||||
activeMenu?: string;
|
activeMenu?: string;
|
||||||
ext?: string;
|
ext?: string;
|
||||||
remark?: string;
|
remark?: string;
|
||||||
@ -56,7 +56,7 @@ export interface MenuVO extends BaseEntity {
|
|||||||
menuType: 'M' | 'C' | 'F' | string;
|
menuType: 'M' | 'C' | 'F' | string;
|
||||||
visible?: string;
|
visible?: string;
|
||||||
status?: string;
|
status?: string;
|
||||||
icon?: string;
|
icon?: string | null;
|
||||||
activeMenu?: string;
|
activeMenu?: string;
|
||||||
ext?: string;
|
ext?: string;
|
||||||
perms?: string;
|
perms?: string;
|
||||||
|
|||||||
@ -63,7 +63,7 @@ export interface VerifyCodeResult {
|
|||||||
|
|
||||||
export interface RouteMeta {
|
export interface RouteMeta {
|
||||||
title?: string;
|
title?: string;
|
||||||
icon?: string;
|
icon?: string | null;
|
||||||
noCache?: boolean;
|
noCache?: boolean;
|
||||||
link?: string;
|
link?: string;
|
||||||
hidden?: boolean;
|
hidden?: boolean;
|
||||||
|
|||||||
@ -17,7 +17,7 @@ import { flattenBackendRoutes, routeIcon } from '@/utils/menu';
|
|||||||
|
|
||||||
interface RouteMetaLite {
|
interface RouteMetaLite {
|
||||||
title?: string;
|
title?: string;
|
||||||
icon?: string;
|
icon?: string | null;
|
||||||
affix?: boolean;
|
affix?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -6,7 +6,7 @@ export interface TagViewItem {
|
|||||||
path: string;
|
path: string;
|
||||||
fullPath: string;
|
fullPath: string;
|
||||||
title: string;
|
title: string;
|
||||||
icon?: string;
|
icon?: string | null;
|
||||||
affix?: boolean;
|
affix?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -121,9 +121,10 @@ const iconMap: Record<string, React.ReactNode> = {
|
|||||||
fileDone: <FileDoneOutlined />
|
fileDone: <FileDoneOutlined />
|
||||||
};
|
};
|
||||||
|
|
||||||
export function routeIcon(icon?: string) {
|
export function routeIcon(icon?: string | null) {
|
||||||
if (!icon) return <AppstoreOutlined />;
|
const iconValue = typeof icon === 'string' ? icon.trim() : '';
|
||||||
const normalizedIcon = icon.replace(/^i-/, '');
|
if (!iconValue) return <AppstoreOutlined />;
|
||||||
|
const normalizedIcon = iconValue.replace(/^i-/, '');
|
||||||
if (normalizedIcon.includes(':')) return <Icon icon={normalizedIcon} />;
|
if (normalizedIcon.includes(':')) return <Icon icon={normalizedIcon} />;
|
||||||
const svgIcon = svgIconMap[normalizedIcon] || svgIconMap[normalizedIcon.toLowerCase()];
|
const svgIcon = svgIconMap[normalizedIcon] || svgIconMap[normalizedIcon.toLowerCase()];
|
||||||
if (svgIcon) {
|
if (svgIcon) {
|
||||||
@ -134,7 +135,7 @@ export function routeIcon(icon?: string) {
|
|||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return iconMap[icon] || iconMap[normalizedIcon] || iconMap[normalizedIcon.toLowerCase()] || <AppstoreOutlined />;
|
return iconMap[iconValue] || iconMap[normalizedIcon] || iconMap[normalizedIcon.toLowerCase()] || <AppstoreOutlined />;
|
||||||
}
|
}
|
||||||
|
|
||||||
function joinPath(parentPath: string, childPath: string) {
|
function joinPath(parentPath: string, childPath: string) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user