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

相关推荐
JavaGuide6 小时前
我用 Claude Code/ZCode+GLM-5.3 从零做了一款 Agent 游戏!
前端·后端
Eason_Lou6 小时前
vue flow使用注意事项
前端·vue.js
小赵同学WoW7 小时前
1-2 TypeScript 中的 `any` 与 `unknown`
前端
six_8 小时前
C# 上位机(持续更新中)
前端·面试·c#
风雨_8 小时前
Git Worktree sourcetree完整使用指南
前端
半个落月8 小时前
React 组件通信进阶:useContext 与自定义 Hook 实战详解
前端·react.js
用户921080262868 小时前
ChatComposer 输入区改造:基于技能市场实现 Agent 输入框
前端
用户45989204565168 小时前
一套 KMP 多仓库版本治理工作流:用 Version Catalog + CI 把发版流水线自动化
前端·kotlin
小赵同学WoW8 小时前
1-4 TypeScript 中的 `number`、`bigint` 与 `string`
前端
小赵同学WoW8 小时前
1-3 `boolean` 与字面量类型
前端