当前位置:   article > 正文

el-table自定义表头颜色;el-table隔行换色;el-table自定义表头颜色header-row-style不生效;el-table隔行换色row-class-name不生效

header-row-style

 1.el-table自定义表头颜色header-row-style不生效

解决办法就是换成header-cell-style

  1. <el-table :data="tableData" @row-click="showRowDetail" style="width: 100%"
  2. :header-cell-style="{ background: '#093376', color: '#fff' }" :row-class-name="tableRowClassName">
  3. <el-table-column type="index" label="序号" width="50">
  4. </el-table-column>
  5. <el-table-column prop="pos" label="位置">
  6. </el-table-column>
  7. <el-table-column prop="time" label="时间">
  8. </el-table-column>
  9. <el-table-column prop="fun" label="识别项">
  10. </el-table-column>
  11. <el-table-column prop="res" label="结果">
  12. </el-table-column>
  13. </el-table>

2.el-table隔行换色row-class-name不生效

js部分

  1. tableRowClassName({ row, rowIndex }) {
  2. console.log(rowIndex, 'rowIndex');
  3. if (rowIndex % 2 == 0) {
  4. return 'even-row';
  5. } else {
  6. return 'odd-row';
  7. }
  8. },

css部分

1.要加深度选择器

2.要加td

3.要加!important

  1. /deep/ .el-table .even-row td {
  2. background-color: #082959 !important;
  3. color: #47e2ff;
  4. }
  5. /deep/ .el-table .odd-row td {
  6. background-color: #051f51 !important;
  7. color: #47e2ff;
  8. }

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/天景科技苑/article/detail/965185
推荐阅读
相关标签
  

闽ICP备14008679号