<el-table-column :label="tabsDataFilters1.orgName" width="370" :fixed="tableFixed">
<el-table-column type="index" label="序号" width="50" align="center" :fixed="tableFixed"></el-table-column>
<el-table-column prop="name" label="姓名" width="200" align="left" :fixed="tableFixed"></el-table-column>
<el-table-column prop="age" :formatter="formatAmount" label="小计" width="120" align="center" :fixed="tableFixed"></el-table-column>
</el-table-column>
mounted进行监听,监听方法如下:
observeClassChanges() {
debugger
this.$nextTick(() => {
const bodyWrapper = this.$refs.table1.$el.querySelector('.el-table__body-wrapper');
if (!bodyWrapper) return;
// 创建 MutationObserver 监听 class 变化
this.observer = new MutationObserver((mutationsList) => {
for (const mutation of mutationsList) {
if (mutation.attributeName === 'class') {
this.removeScrollingClasses(bodyWrapper);
}
}
});
// 监听 `class` 变化
this.observer.observe(bodyWrapper, {
attributes: true,
attributeFilter: ['class'],
});
// 初始移除 class,防止渲染时已有
this.removeScrollingClasses(bodyWrapper);
});
},
// 滚动中间行样式移除
removeScrollingClasses(bodyWrapper) {
if (bodyWrapper.classList.contains('is-scrolling-middle')) {
bodyWrapper.classList.remove('is-scrolling-middle');
}
if (bodyWrapper.classList.contains('is-scrolling-left')) {
bodyWrapper.classList.remove('is-scrolling-left');
}
},
elment Table多级表头固定列后,合计行错位显示问题解决
晴空万里藏片云2025-02-24 1:37
相关推荐
小小前端--可笑可笑2 分钟前
Vue / React 单页应用刷新 /login 无法访问问题分析小林敲代码778825 分钟前
记一次 Vue 项目首屏优化:从 7.1s 到 0.9s,深挖 Gzip 的力量前端大卫32 分钟前
写给年轻程序员的几点小建议Highcharts.js1 小时前
什么是向量图表?如何用 Highcharts 快速创建一个笛卡尔坐标图/矢量图?NEXT061 小时前
React 闭包陷阱深度解析:从词法作用域到快照渲染脱离语言2 小时前
Jeecg3.8.2 前端经验汇总NEXT062 小时前
useMemo 与 useCallback 的原理与最佳实践小爱丨同学2 小时前
React-Context用法汇总 +注意点徐同保3 小时前
python如何手动抛出异常极客小云3 小时前
【实时更新 | 2026年国内可用的npm镜像源/加速器配置大全(附测速方法)】