如何去掉滚动条以及设置滚动条,使得自动适应浏览器宽高?(Vue开发)
在template里面
<div class="form-scroll" :style="{maxHeight:Height}">
在Vue的生命周期里面
mounted() {
// 计算高度
var toHeight = document.documentElement.clientHeight //获取浏览器可视区的高度
this.Height = Number(toHeight - 225) + 'px' //减掉部分占用的高度
console.log(this.Height)
}
css样式
.form-scroll {
overflow-y: auto;
margin-top: 5px;
}
::-webkit-scrollbar{//去掉外部滚动条
h
width: 0; eight: 0;
}
.form-scroll::-webkit-scrollbar {//设置内部滚动条 横竖滚动条宽度设置
width: 6px;
height: 6px;
}
.form-scroll::-webkit-scrollbar-thumb {//设置滚动条的颜色椭圆形以及阴影
border-radius: 4px;
-webkit-box-shadow: inset 0 0 2px #d1d1d1;
background: #e4e4e4;
}
如何去掉外部滚动条和设置滚动条,使得自动适应浏览器宽高?
最新推荐文章于 2024-04-12 12:05:31 发布