mirror of
https://gitee.com/JavaLionLi/plus-ui.git
synced 2026-09-13 07:43:43 +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;
|
||||
visible?: string;
|
||||
status?: string;
|
||||
icon?: string;
|
||||
icon?: string | null;
|
||||
activeMenu?: string;
|
||||
ext?: string;
|
||||
remark?: string;
|
||||
@ -56,7 +56,7 @@ export interface MenuVO extends BaseEntity {
|
||||
menuType: 'M' | 'C' | 'F' | string;
|
||||
visible?: string;
|
||||
status?: string;
|
||||
icon?: string;
|
||||
icon?: string | null;
|
||||
activeMenu?: string;
|
||||
ext?: string;
|
||||
perms?: string;
|
||||
|
||||
@ -63,7 +63,7 @@ export interface VerifyCodeResult {
|
||||
|
||||
export interface RouteMeta {
|
||||
title?: string;
|
||||
icon?: string;
|
||||
icon?: string | null;
|
||||
noCache?: boolean;
|
||||
link?: string;
|
||||
hidden?: boolean;
|
||||
|
||||
@ -17,7 +17,7 @@ import { flattenBackendRoutes, routeIcon } from '@/utils/menu';
|
||||
|
||||
interface RouteMetaLite {
|
||||
title?: string;
|
||||
icon?: string;
|
||||
icon?: string | null;
|
||||
affix?: boolean;
|
||||
}
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@ export interface TagViewItem {
|
||||
path: string;
|
||||
fullPath: string;
|
||||
title: string;
|
||||
icon?: string;
|
||||
icon?: string | null;
|
||||
affix?: boolean;
|
||||
}
|
||||
|
||||
|
||||
@ -121,9 +121,10 @@ const iconMap: Record<string, React.ReactNode> = {
|
||||
fileDone: <FileDoneOutlined />
|
||||
};
|
||||
|
||||
export function routeIcon(icon?: string) {
|
||||
if (!icon) return <AppstoreOutlined />;
|
||||
const normalizedIcon = icon.replace(/^i-/, '');
|
||||
export function routeIcon(icon?: string | null) {
|
||||
const iconValue = typeof icon === 'string' ? icon.trim() : '';
|
||||
if (!iconValue) return <AppstoreOutlined />;
|
||||
const normalizedIcon = iconValue.replace(/^i-/, '');
|
||||
if (normalizedIcon.includes(':')) return <Icon icon={normalizedIcon} />;
|
||||
const svgIcon = svgIconMap[normalizedIcon] || svgIconMap[normalizedIcon.toLowerCase()];
|
||||
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) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user