perf: 修改渲染方式

This commit is contained in:
rd
2025-07-25 17:26:46 +08:00
parent 52a696c133
commit 3d08f9c8d3

View File

@ -88,30 +88,20 @@ export default defineComponent({
// 跳过没有 name 的菜单项,防止 key 报错
if (!element?.name) return;
// const icon element?.meta?.icon
const icon = element?.meta?.icon
? (() => {
if (typeof element.meta.icon === 'string') {
return h(
'svg',
{
style: {
width: '16px',
height: '16px',
},
},
[
h('use', {
'xlink:href': element.meta.icon,
}),
],
return (
<svg class="w-16px h-16px">
<use xlinkHref={element.meta.icon} />
</svg>
);
} else {
// 如果是对象,按原来的方式渲染
return h(element.meta.icon as object);
}
})()
: null;
if (element.children && element.children.length > 0) {
nodes.push(
<a-sub-menu