目前效果
需求效果
1.隐藏bodyWrapper滚动条,显示footerWrapper滚动条
css代码如下:
div ::v-deep .el-table--scrollable-x .el-table__body-wrapper{overflow-x: hidden!important;z-index: 2!important;}
div ::v-deep .el-table__footer-wrapper {overflow-x: auto;border-top: 1px solid #f4f4f4;}
监听footerWrapper滚动条
在el-table上加上ref=“detailTable”
mounted() {
var tableBody = this.$refs.detailTable.$refs.footerWrapper
tableBody.addEventListener('scroll', () => {
const scrollLeft = tableBody.scrollLeft
this.$refs.detailTable.$refs.bodyWrapper.scrollLeft = scrollLeft
})
},
参考文章
https://blog.csdn.net/qq_32289849/article/details/125290777?spm=1001.2014.3001.5502