el-table 固定前n行 配合 max-height 生效

:row-class-name="TableRowClassName" 加上类名

javascript 复制代码
   <el-table
        :data="computedTableList"
        border
        style="width: 100%"
        :row-class-name="TableRowClassName"
        max-height="800">
        <el-table-column fixed prop="name" align="center" width="185" :key="1">
 </el-table>

  function TableRowClassName ({ row, rowIndex }) {
    if (row.isFalseData) {
      return 'top_bgc fixed-row'
    }
    if (row.isSticky) {
      return 'sticky_bgc'
    }
  }


  // 顶部固定 悬浮
  :deep(.el-table tr.el-table__row.fixed-row) {
    position: sticky; //粘性定位
    position: -webkit-sticky;
    z-index: 999;
  }
  :deep(.el-table tr.el-table__row.fixed-row:nth-of-type(1)) {
    top: 0;  
  }
  :deep(.el-table tr.el-table__row.fixed-row:nth-of-type(2)) {
    top: 94px;  // 根据每一行的高度自行调整
  }
  :deep(.el-table tr.el-table__row.fixed-row:nth-of-type(3)) {
    top: 188px;
  }
相关推荐
喵了几个咪13 分钟前
AI重构软件开发范式:框架与脚手架为何仍是生产级开发的刚需?
vue.js·人工智能·react.js·重构·golang·ai编程
ZC跨境爬虫33 分钟前
跟着 MDN 学CSS day_36:(float、clear与BFC深度解析)
前端·javascript·css·ui·交互
糯米团子7491 小时前
javascript高频知识点
开发语言·前端·javascript
无风听海2 小时前
Bearer Token 权威指南:从原理到生产级安全实践
前端·javascript·安全
riuphan2 小时前
JavaScript 类型判断完全指南
前端·javascript
Hilaku2 小时前
前端工程师最终会变成 AI工程师?
前端·javascript·程序员
flyinmind2 小时前
Java环境与Android环境中使用QuickJS
java·开发语言·javascript·quickjs
如烟花的信页2 小时前
数美滑块逆向分析
javascript·爬虫·python·js逆向
子琦啊2 小时前
华为 OD 2026年5月笔试题解析
javascript·华为
无风听海2 小时前
Promise 与 Async Await 深度解析
前端·javascript