fix: 修复菜单本地图标显示问题

This commit is contained in:
xlsea 2025-05-15 22:44:41 +08:00
parent e6ac3797b9
commit 3356928138
5 changed files with 10 additions and 8 deletions

View File

@ -38,9 +38,9 @@ async function getMenuList() {
getMenuList(); getMenuList();
function renderPrefix({ option }: { option: TreeOption }) { function renderPrefix({ option }: { option: TreeOption }) {
const renderLocalIcon = String(option.icon).startsWith('icon-'); const renderLocalIcon = String(option.icon).startsWith('local-icon-');
const icon = renderLocalIcon ? undefined : String(option.icon); const icon = renderLocalIcon ? undefined : String(option.icon);
const localIcon = renderLocalIcon ? String(option.icon).replace('icon-', 'menu-') : undefined; const localIcon = renderLocalIcon ? String(option.icon).replace('local-icon-', 'menu-') : undefined;
return <SvgIcon icon={icon} localIcon={localIcon} />; return <SvgIcon icon={icon} localIcon={localIcon} />;
} }
</script> </script>

View File

@ -61,9 +61,9 @@ watch([expandAll, options], ([newVal]) => {
}); });
function renderPrefix({ option }: { option: TreeOption }) { function renderPrefix({ option }: { option: TreeOption }) {
const renderLocalIcon = String(option.icon).startsWith('icon-'); const renderLocalIcon = String(option.icon).startsWith('local-icon-');
let icon = renderLocalIcon ? undefined : String(option.icon ?? 'material-symbols:buttons-alt-outline-rounded'); let icon = renderLocalIcon ? undefined : String(option.icon ?? 'material-symbols:buttons-alt-outline-rounded');
const localIcon = renderLocalIcon ? String(option.icon).replace('icon-', 'menu-') : undefined; const localIcon = renderLocalIcon ? String(option.icon).replace('local-icon-', 'menu-') : undefined;
if (icon === '#') { if (icon === '#') {
icon = 'material-symbols:buttons-alt-outline-rounded'; icon = 'material-symbols:buttons-alt-outline-rounded';
} }

View File

@ -93,9 +93,9 @@ async function handleDeleteMenu(id?: CommonType.IdType) {
} }
function renderPrefix({ option }: { option: TreeOption }) { function renderPrefix({ option }: { option: TreeOption }) {
const renderLocalIcon = String(option.icon).startsWith('icon-'); const renderLocalIcon = String(option.icon).startsWith('local-icon-');
const icon = renderLocalIcon ? undefined : String(option.icon); const icon = renderLocalIcon ? undefined : String(option.icon);
const localIcon = renderLocalIcon ? String(option.icon).replace('icon-', 'menu-') : undefined; const localIcon = renderLocalIcon ? String(option.icon).replace('local-icon-', 'menu-') : undefined;
return <SvgIcon icon={icon} localIcon={localIcon} />; return <SvgIcon icon={icon} localIcon={localIcon} />;
} }

View File

@ -122,12 +122,12 @@ async function handleSubmit() {
menuId, menuId,
parentId, parentId,
menuName, menuName,
icon,
orderNum, orderNum,
queryParam, queryParam,
isFrame, isFrame,
isCache, isCache,
menuType, menuType,
icon,
visible: menuVisible, visible: menuVisible,
status, status,
perms, perms,
@ -264,7 +264,7 @@ function onCreate() {
</NInput> </NInput>
</template> </template>
<template v-if="iconType === '2'"> <template v-if="iconType === '2'">
<NSelect v-model:value="model.icon" placeholder="请选择本地图标" :options="localIconOptions" /> <NSelect v-model:value="model.icon" placeholder="请选择本地图标" filterable :options="localIconOptions" />
</template> </template>
</NFormItemGi> </NFormItemGi>
<NFormItemGi v-if="!isBtn" :span="24" path="path"> <NFormItemGi v-if="!isBtn" :span="24" path="path">

View File

@ -123,6 +123,8 @@ const {
align: 'center', align: 'center',
width: 150, width: 150,
render: row => { render: row => {
if (row.userId === 1) return null;
const editBtn = () => { const editBtn = () => {
return ( return (
<ButtonIcon <ButtonIcon