diff --git a/src/layouts/components/SubSidebar/index.vue b/src/layouts/components/SubSidebar/index.vue index a6c70997..db84f88b 100755 --- a/src/layouts/components/SubSidebar/index.vue +++ b/src/layouts/components/SubSidebar/index.vue @@ -13,11 +13,20 @@ const route = useRoute() const settingsStore = useSettingsStore() const menuStore = useMenuStore() -const sidebarScrollTop = ref(0) - -function onSidebarScroll(e: Event) { - sidebarScrollTop.value = (e.target as HTMLElement).scrollTop +const subSidebarRef = ref() +const showShadowTop = ref(false) +const showShadowBottom = ref(false) +function onSidebarScroll() { + const scrollTop = subSidebarRef.value.scrollTop + showShadowTop.value = scrollTop > 0 + const clientHeight = subSidebarRef.value.clientHeight + const scrollHeight = subSidebarRef.value.scrollHeight + showShadowBottom.value = Math.ceil(scrollTop + clientHeight) < scrollHeight } + +onMounted(() => { + onSidebarScroll() +}) +
+ + + +
@@ -98,8 +113,16 @@ function onSidebarScroll(e: Event) { display: none; } - &.shadow { - box-shadow: inset 0 10px 10px -10px var(--g-box-shadow-color); + &.shadow-top { + box-shadow: inset 0 10px 10px -10px var(--g-box-shadow-color), inset 0 0 0 transparent; + } + + &.shadow-bottom { + box-shadow: inset 0 0 0 transparent, inset 0 -10px 10px -10px var(--g-box-shadow-color); + } + + &.shadow-top.shadow-bottom { + box-shadow: inset 0 10px 10px -10px var(--g-box-shadow-color), inset 0 -10px 10px -10px var(--g-box-shadow-color); } } diff --git a/src/layouts/components/Topbar/Toolbar/leftSide.vue b/src/layouts/components/Topbar/Toolbar/leftSide.vue index 2a3b6348..3659255f 100644 --- a/src/layouts/components/Topbar/Toolbar/leftSide.vue +++ b/src/layouts/components/Topbar/Toolbar/leftSide.vue @@ -7,15 +7,11 @@ defineOptions({ }) const settingsStore = useSettingsStore() - -const enableSubMenuCollapseButton = computed(() => { - return settingsStore.mode === 'mobile' || settingsStore.settings.menu.enableSubMenuCollapseButton -})