mirror of
https://gitee.com/fantastic-admin/basic.git
synced 2024-12-04 21:18:16 +08:00
修复次导航的显隐逻辑
This commit is contained in:
parent
9e3797c05c
commit
73bd98e0f4
11
src/App.vue
11
src/App.vue
@ -5,10 +5,8 @@ import hotkeys from 'hotkeys-js'
|
||||
import elementPlusLocaleZhCN from 'element-plus/es/locale/lang/zh-cn.mjs'
|
||||
import eventBus from './utils/eventBus'
|
||||
import useSettingsStore from '@/store/modules/settings'
|
||||
import useMenuStore from '@/store/modules/menu'
|
||||
|
||||
const settingsStore = useSettingsStore()
|
||||
const menuStore = useMenuStore()
|
||||
const { auth } = useAuth()
|
||||
|
||||
// 侧边栏主导航当前实际宽度
|
||||
@ -26,15 +24,6 @@ const subSidebarActualWidth = computed(() => {
|
||||
if (settingsStore.settings.menu.subMenuCollapse && settingsStore.mode !== 'mobile') {
|
||||
actualWidth = Number.parseInt(getComputedStyle(document.documentElement).getPropertyValue('--g-sub-sidebar-collapse-width'))
|
||||
}
|
||||
if (
|
||||
menuStore.sidebarMenus.length === 1
|
||||
&& (
|
||||
!menuStore.sidebarMenus[0].children
|
||||
|| menuStore.sidebarMenus[0]?.children.every(item => item.meta?.sidebar === false)
|
||||
)
|
||||
) {
|
||||
actualWidth = 0
|
||||
}
|
||||
return `${actualWidth}px`
|
||||
})
|
||||
|
||||
|
@ -18,25 +18,11 @@ const sidebarScrollTop = ref(0)
|
||||
function onSidebarScroll(e: Event) {
|
||||
sidebarScrollTop.value = (e.target as HTMLElement).scrollTop
|
||||
}
|
||||
|
||||
const enableSidebar = computed(() => {
|
||||
return settingsStore.mode === 'mobile' || (
|
||||
['side', 'head', 'single'].includes(settingsStore.settings.menu.menuMode)
|
||||
&& menuStore.sidebarMenus.length !== 0
|
||||
&& !(
|
||||
menuStore.sidebarMenus.length === 1
|
||||
&& (
|
||||
!menuStore.sidebarMenus[0].children
|
||||
|| menuStore.sidebarMenus[0]?.children.every(item => item.meta?.sidebar === false)
|
||||
)
|
||||
)
|
||||
)
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div
|
||||
v-if="enableSidebar" class="sub-sidebar-container" :class="{
|
||||
class="sub-sidebar-container" :class="{
|
||||
'is-collapse': settingsStore.mode === 'pc' && settingsStore.settings.menu.subMenuCollapse,
|
||||
}"
|
||||
>
|
||||
|
@ -4,7 +4,6 @@ import Breadcrumb from '../../Breadcrumb/index.vue'
|
||||
import BreadcrumbItem from '../../Breadcrumb/item.vue'
|
||||
import Tools from '../../Tools/index.vue'
|
||||
import useSettingsStore from '@/store/modules/settings'
|
||||
import useMenuStore from '@/store/modules/menu'
|
||||
|
||||
defineOptions({
|
||||
name: 'Toolbar',
|
||||
@ -13,20 +12,9 @@ defineOptions({
|
||||
const route = useRoute()
|
||||
|
||||
const settingsStore = useSettingsStore()
|
||||
const menuStore = useMenuStore()
|
||||
|
||||
const enableSubMenuCollapseButton = computed(() => {
|
||||
return settingsStore.mode === 'mobile' || (
|
||||
['side', 'head', 'single'].includes(settingsStore.settings.menu.menuMode)
|
||||
&& settingsStore.settings.menu.enableSubMenuCollapseButton
|
||||
&& !(
|
||||
menuStore.sidebarMenus.length === 1
|
||||
&& (
|
||||
!menuStore.sidebarMenus[0].children
|
||||
|| menuStore.sidebarMenus[0]?.children.every(item => item.meta?.sidebar === false)
|
||||
)
|
||||
)
|
||||
)
|
||||
return settingsStore.mode === 'mobile' || settingsStore.settings.menu.enableSubMenuCollapseButton
|
||||
})
|
||||
|
||||
const breadcrumbList = computed(() => {
|
||||
|
Loading…
Reference in New Issue
Block a user