我的角度应用程序中有一个侧边栏导航,该侧边栏具有可折叠项(菜单内的菜单),其中某些菜单包含许多项,我需要滚动条进行导航。我用overflow:auto
来“动态”显示滚动条,就像我说的那样,这很好,但是滚动条似乎在视口之外垂直调整大小,几乎与“扩展”内容的终止位置有关,所以看不到向下箭头。我正在使用scss,
.sidebar-scroll {
height: 100%;
border-top: 1px solid black;
overflow: auto;
}
我应该注意,.sidebar-scroll在侧边栏的另一个元素中,实际上仅用于常规颜色和样式。这是此组件的整个scss。
@import 'src/assets/scss/functions';
@import 'src/assets/scss/variables';
@import 'src/assets/scss/mixins';
.sidebar {
position: fixed;
width: $sidebar-width;
background-color: $light;
box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.16), 0 2px 10px 0 rgba(0, 0, 0, 0.12);
left: 0;
top: 0;
height: 100%;
z-index: $zindex-fixed;
background-image: url("#{$image-path}sidenav.jpg");
background-size: cover;
background-repeat: no-repeat;
background-position: center;
& > * {
z-index: 2;
position: relative;
}
&:after {
content: '';
background-color: rgba(255, 255, 255, 0.8);
position: absolute;
left: 0;
top: 0;
z-index: 1;
@include size(100%);
}
.navbar-brand {
display: block;
margin: 1.5rem 0;
padding: 0.5rem;
color: $body-color;
}
.form-group {
position: relative;
.form-control {
border-radius: 0;
border-left: 0;
border-right: 0;
font-weight: 100;
font-size: $font-size-base;
}
.btn {
position: absolute;
border-radius: 0;
background-color: transparent;
right: 0;
top: 0;
font-size: $font-size-base;
height: 100%;
color: $gray-600;
&:hover {
color: $body-color;
}
}
& *:focus {
box-shadow: none;
}
}
.nav {
.nav-item {
.nav-link {
color: $body-color;
font-size: $font-size-sm;
line-height: 1.5;
&:hover {
background-color: rgba(0, 0, 0, 0.05);
}
.fa {
float: left;
margin-top: 5px;
margin-right: $sidenav-icon-margin;
width: $sidenav-icon-size;
& ~ .fa {
float: right;
margin-left: 10px;
margin-right: 0;
}
}
&.active {
color: $primary;
}
}
.nav {
display: block;
overflow: hidden;
.nav-link {
background-color: rgba(95, 93, 93, 0.15);
padding-left: calc(
1rem + #{$sidenav-icon-size} + #{$sidenav-icon-margin}
);
font-size: ($font-size-sm - 0.05rem);
&:hover {
background-color: rgba(0, 0, 0, 0.05);
}
}
}
}
}
}
.sidebar-scroll {
height: 100%;
overflow: auto;
}
谢谢。