fix 修复 icon #号默认值与空值不在一列展示

This commit is contained in:
疯狂的狮子Li 2026-06-29 17:48:27 +08:00
parent 33fb49d683
commit 8a3ff74833

View File

@ -75,7 +75,7 @@
<el-table-column prop="menuName" label="菜单名称" :show-overflow-tooltip="true" width="220"> <el-table-column prop="menuName" label="菜单名称" :show-overflow-tooltip="true" width="220">
<template #default="scope"> <template #default="scope">
<div class="menu-name-cell"> <div class="menu-name-cell">
<svg-icon v-if="scope.row.icon" :icon-class="scope.row.icon" /> <svg-icon v-if="isMenuIconVisible(scope.row.icon)" :icon-class="scope.row.icon" />
<span class="menu-name-text">{{ scope.row.menuName }}</span> <span class="menu-name-text">{{ scope.row.menuName }}</span>
</div> </div>
</template> </template>
@ -431,6 +431,11 @@ const { dialog, openDialog, closeDialog, setTitle } = useDialogState();
type MenuTagType = 'warning' | 'primary' | 'success' | 'danger'; type MenuTagType = 'warning' | 'primary' | 'success' | 'danger';
const isMenuIconVisible = (icon?: string) => {
const normalizedIcon = icon?.trim();
return !!normalizedIcon && normalizedIcon !== '#';
};
const getMenuTypeMeta = (menu: Partial<MenuVO>): { label: string; type: MenuTagType } => { const getMenuTypeMeta = (menu: Partial<MenuVO>): { label: string; type: MenuTagType } => {
if (menu.menuType === MenuTypeEnum.F) { if (menu.menuType === MenuTypeEnum.F) {
return { label: '按钮', type: 'warning' }; return { label: '按钮', type: 'warning' };