fix(projects): fix horizontal menu

This commit is contained in:
Soybean 2024-01-25 18:52:00 +08:00
parent 4aae6a5297
commit d886e50fd3

View File

@ -35,9 +35,7 @@ const isHorizontal = computed(() => props.mode === 'horizontal');
const siderCollapse = computed(() => themeStore.layout.mode === 'vertical' && appStore.siderCollapse); const siderCollapse = computed(() => themeStore.layout.mode === 'vertical' && appStore.siderCollapse);
const menuHeightStyle = computed(() => const headerHeight = computed(() => `${themeStore.header.height}px`);
isHorizontal.value ? { '--n-item-height': `${themeStore.header.height}px` } : {}
);
const selectedKey = computed(() => { const selectedKey = computed(() => {
const { hideInMenu, activeMenu } = route.meta; const { hideInMenu, activeMenu } = route.meta;
@ -83,11 +81,14 @@ watch(
:options="naiveMenus" :options="naiveMenus"
:inverted="darkTheme" :inverted="darkTheme"
:indent="18" :indent="18"
class="transition-300" responsive
:style="menuHeightStyle"
@update:value="handleClickMenu" @update:value="handleClickMenu"
/> />
</SimpleScrollbar> </SimpleScrollbar>
</template> </template>
<style scoped></style> <style scoped>
:deep(.n-menu--horizontal) {
--n-item-height: v-bind(headerHeight) !important;
}
</style>