怎么自定义elementui表格的单元格大小 element ui table自定义表头

element UI table组件 修改单独行/列样式

博客:
https://blog.csdn.net/weixin_40297452/article/details/

问题:因为我重写了一点样式,那个表头的第一列padding-left:0 (工程量紧靠着左边);

需求:工程量这列不能紧靠着左边,留点空隙,并给table thead 加边框

第一种方法:给table加一个类名,然后指定第一列和 表头的第一列

 .second-table td:first-of-type,.second-table th:first-of-type{
      padding-left: 15px;
    }

第二种方法:这种方法是加到行内样式,谨慎使用

//表格中加入:
:header-cell-style="secondheadCellStyle"

//在methods中写一个方法
 secondheadCellStyle({ row, column, rowIndex, columnIndex }) {  // 一级表头行的 style 的回调方法
      if (rowIndex == 0) {
          return {"border":"1px solid #e6edf0 !important"}
      }
  },




原文链接:,转发请注明来源!