element-ui中el-table使用fixed固定列后,修改滚动条样式导致横向以及竖向滚动条与列表有间隙的问题
问题如下:

修改后:

我使用的滚动条样式宽高都是5px,和下方css中的一致
解决办法: 初始版解决了之后会出现一个问题就是如果没有滚动条,则左侧固定列还会和下方边线有间隙,右侧也是如此,所以又进行了对滚动条下固定列样式的修改
初始版:
右侧间隙样式:
.el-table__fixed-right { right: 5px !important; // 竖向滚动条宽度 height: 100%; }
下方间隙样式:
/deep/ .el-table__fixed { height: auto !important; bottom: 5px !important; // 横向滚动条高度 } /deep/ .el-table__fixed-body-wrapper { max-height: calc(100% - 36px) !important; // 36px是设置的列表统一行高 bottom: 0 !important; } /deep/ .el-table__fixed-right-patch { width: 0 !important; }
最终版:
/deep/ .el-table__fixed-right { right: 0px !important; height: 100%; } /deep/ .el-table__fixed-right .el-table__fixed-body-wrapper { height: auto !important; bottom: 4px !important; max-height: 100% !important } /deep/ .el-table__fixed-right-patch { width: 5px !important; } /deep/ .el-table__fixed { height: auto !important; bottom: 0px !important; } /deep/ .el-table__fixed .el-table__fixed-body-wrapper { height: auto !important; bottom: 0px !important; max-height: 100% !important } /deep/ .el-table--scrollable-x .el-table__fixed { height:auto !important; bottom: 0px !important; } /deep/ .el-table--scrollable-x .el-table__fixed-right { bottom: 0px !important; } /deep/ .el-table--scrollable-y .el-table__fixed-right { right: 5px !important; height: auto !important; } /deep/ .el-table--scrollable-x .el-table__body-wrapper::-webkit-scrollbar { height: 7px !important; // 这里改为7px,是因为横向滚动条不知什么原因被挤压成了一条线,不好拖拽,因此加高一下 } /deep/ .el-table--fluid-height .el-table__fixed { bottom: 5px !important; }
本文来自博客园,作者:代码改变世界是吧,转载请注明原文链接:https://www.cnblogs.com/zyh-web/p/17225980.html

浙公网安备 33010602011771号