vue element-ui 表格横向滚动条在合计项下方

目前效果

需求效果

1.隐藏bodyWrapper滚动条,显示footerWrapper滚动条

css代码如下:

cpp 复制代码
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"

cpp 复制代码
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

相关推荐
疯华整猫13 小时前
被杀掉之后:我把 Android 的「唤起 + 常驻」重做了一遍
前端·面试·架构
ruanno_top13 小时前
点全选,已选的被清空了:Transfer 三态复选框的三个 bug
vue.js
时间的情敌14 小时前
Cesium 加载 3D Tiles 倾斜摄影、压平、样式设置(Vue3 实战)
vue.js·3d·cesium
IT_陈寒15 小时前
Java开发实战:从入门到精通
前端·人工智能·后端
风骏时光牛马15 小时前
生成一个AI转岗经历标题,只需要一个标题,不需要其他的任何文本。
前端
Csvn1 天前
Monorepo
前端
Csvn1 天前
流水线
前端
Csvn1 天前
微前端架构
前端
Linux-lucky1 天前
45-Linux学习之旅之防火墙与WEB加固
linux·前端·网络·学习·ubuntu
风骏时光牛马1 天前
生成一个移动端标题,只需要一个标题,不需要其他的任何文本。
前端