2021-05-15
阅读:895
在全局sass/less 或者css文件中添加如下样式
.el-table__body-wrapper{
&::-webkit-scrollbar {
width : 8px;
height: 8px;
}
&::-webkit-scrollbar-track {
height : 8px;
// width : 8px;
background-color : #ffffff;
-webkit-border-radius: 2em;
-moz-border-radius : 2em;
border-radius : 2em;
}
&::-webkit-scrollbar-thumb {
background-color : #CACBD4;
background-clip : padding-box;
height : 8px;
-webkit-border-radius: 2em;
-moz-border-radius : 2em;
border-radius : 2em;
}
}
在之前代码的下面,加上
.el-table__fixed, .el-table__fixed-right{
height: calc(100% - 8px) !important;//动态计算定位到右边列的高度 100% -8 8 为自定义滚动条的宽高
box-shadow:0px -6px 6px rgb(0 0 0 / 12%) ;
.el-table__fixed-body-wrapper{
height: calc(100% - 8px) !important;
}
&::before{
display: none;
}
}
// 当表格没有滚动条时
.el-table__body-wrapper.is-scrolling-none~.el-table__fixed-right{
height: 100% !important;
box-shadow: none !important;
}
// 当表格有纵向滚动条时
.el-table--scrollable-y .el-table__fixed-right{
right: 8px !important;//8 为自定义滚动条的宽高
}
// 当表格只有横向滚动条,没有纵向滚动条时
.el-table--scrollable-x:not(.el-table--scrollable-y) .el-table__fixed-right{
right: 0 !important;
}
可以看到,最右侧列设置定位,并且出现滚动条后,滚动条两侧不会再出现空白,并且,底部文字不会透出