在element ui的table表格中如果设置了固定列,那么在内容部分滚动的时候会出现内容和固定列不一起滚动的情况,解决方法就是设置样式让固定列和内容区域的最大高度相同,为了样式好看,让固定列定位离右边有点距离,样式设置为全局样式,如果只是某个页面需要,那么用deep穿透即可,样式代码如下:
/*sass全局样式写法,单个页面使用前面加/deep/*/
.el-table__fixed-body-wrapper {
max-height: 675px !important;
overflow-y: scroll !important;
&::-webkit-scrollbar {
display: none;
}
}
.el-table__body-wrapper,.is-scrolling-left {
max-height: 675px !important;
overflow-y: scroll !important;
}
.el-table__fixed-right {
right: 7px !important;
}