<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
相关推荐
HashTang3 分钟前
Claude Code 源码中 REPL.tsx 深度解析:一个 5005 行 React 组件的架构启示wendycwb1 小时前
前端城市地址根据最后一级倒推,获取各层级id的方法终端鹿1 小时前
Vue3 模板引用 (ref):操作 DOM 与子组件实例 从入门到精通千寻girling1 小时前
不知道 Java 全栈 + AI 编程有没有搞头 ?小码哥_常2 小时前
Android开发:精准捕获应用的前后台行踪蜡台2 小时前
Vue 打包优化木斯佳2 小时前
前端八股文面经大全:快手前端一面 (2026-03-29)·面经深度解析皙然2 小时前
Redis配置文件(redis.conf)超详细详解卷帘依旧3 小时前
JavaScript中this绑定问题详解dweizhao3 小时前
突发!Claude Code源码泄露了