Skip to content

Commit

Permalink
fix: 左侧导航菜单在高度不足时渲染不全的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
pany-ang committed Nov 20, 2024
1 parent 92d0778 commit 5b452a4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 16 deletions.
1 change: 1 addition & 0 deletions src/layouts/LeftTopMode.vue
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ $transition-time: 0.35s;
}
.sidebar-container {
background-color: var(--el-menu-bg-color);
transition: width $transition-time;
width: var(--v3-sidebar-width) !important;
height: 100%;
Expand Down
18 changes: 2 additions & 16 deletions src/layouts/components/Sidebar/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,6 @@ const sidebarMenuHoverBgColor = computed(() => {
const tipLineWidth = computed(() => {
return !isTop.value ? "2px" : "0px"
})
// 当为顶部模式时隐藏垂直滚动条
const hiddenScrollbarVerticalBar = computed(() => {
return isTop.value ? "none" : "block"
})
</script>

<template>
Expand Down Expand Up @@ -84,37 +80,27 @@ const hiddenScrollbarVerticalBar = computed(() => {
.has-logo {
.el-scrollbar {
// 多 1% 是为了在左侧模式时侧边栏最底部不显示 1px 左右的白色线条
height: calc(101% - var(--v3-header-height));
height: calc(100% - var(--v3-header-height));
}
}
.el-scrollbar {
// 多 1% 是为了在顶部模式时防止垂直滚动
height: 101%;
height: 100%;
:deep(.scrollbar-wrapper) {
// 限制水平宽度
overflow-x: hidden !important;
.el-scrollbar__view {
height: 100%;
}
}
// 滚动条
:deep(.el-scrollbar__bar) {
&.is-horizontal {
// 隐藏水平滚动条
display: none;
}
&.is-vertical {
// 当为顶部模式时隐藏垂直滚动条
display: v-bind(hiddenScrollbarVerticalBar);
}
}
}
.el-menu {
border: none;
min-height: 100%;
width: 100% !important;
}
Expand Down

0 comments on commit 5b452a4

Please sign in to comment.