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