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();
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 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} />;
}
</script>

View File

@ -61,9 +61,9 @@ watch([expandAll, options], ([newVal]) => {
});
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');
const localIcon = renderLocalIcon ? String(option.icon).replace('icon-', 'menu-') : undefined;
const localIcon = renderLocalIcon ? String(option.icon).replace('local-icon-', 'menu-') : undefined;
if (icon === '#') {
icon = 'material-symbols:buttons-alt-outline-rounded';
}