feat(menu): 添加菜单项隐藏功能
- 在 ElSubMenu 组件中添加 popperClass 属性,根据菜单是否折叠来决定是否隐藏- 在样式中添加 .hide-popper 类,用于隐藏菜单项
This commit is contained in:
@@ -448,7 +448,10 @@ const renderMenu = (item) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
if (item.children && item.children.length > 0) {
|
if (item.children && item.children.length > 0) {
|
||||||
return h(ElSubMenu, { index: `group-${item.id}` }, {
|
return h(ElSubMenu, {
|
||||||
|
index: `group-${item.id}`,
|
||||||
|
popperClass: isCollapsed.value ? 'hide-popper' : ''
|
||||||
|
}, {
|
||||||
title: () => h('div', { onClick: () => selectFile(item), style: 'width: 100%;' }, [ wrappedContent() ]),
|
title: () => h('div', { onClick: () => selectFile(item), style: 'width: 100%;' }, [ wrappedContent() ]),
|
||||||
default: () => item.children.map(child => renderMenu(child))
|
default: () => item.children.map(child => renderMenu(child))
|
||||||
});
|
});
|
||||||
@@ -837,6 +840,10 @@ watch(activeMenu, (newVal) => {
|
|||||||
background-color: var(--primary-color-light) !important;
|
background-color: var(--primary-color-light) !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.hide-popper {
|
||||||
|
display: none !important;
|
||||||
|
}
|
||||||
|
|
||||||
/* 移除预览中代码块的内部滚动条 */
|
/* 移除预览中代码块的内部滚动条 */
|
||||||
.markdown-preview .vditor-reset pre {
|
.markdown-preview .vditor-reset pre {
|
||||||
max-height: none !important;
|
max-height: none !important;
|
||||||
|
|||||||
Reference in New Issue
Block a user