el-table表格横竖双表头,表头带斜线

实现效果

在这里插入图片描述

代码

<el-table :data="tableData" border>
   <el-table-column label="数据" align="right" width="150">
     <el-table-column prop="name" label="数据指标" width="150">
     </el-table-column>
   </el-table-column>
   <el-table-column
     v-for="(col, i) in columnList"
     :key="i"
     :prop="col.prop"
     :label="col.label"
     align="center"
   >
     <template v-if="col.children">
       <el-table-column
         v-for="(item, index) in col.children"
         :key="index"
         :prop="item.prop"
         :label="item.label"
       >
       </el-table-column>
     </template>
   </el-table-column>
 </el-table>

data(){
 return {
 	columnList: [
        {
          prop: "expected",
          label: "预期值",
        },
        {
          prop: "accuracy",
          label: "训练值",
        },
        {
          prop: "test",
          label: "检验值",
        },
      ],
      tableData: [
        {
          name: "覆盖率",
          expected: "111",
          accuracy: "111",
          test: "111",
        },
        {
          name: "准确率",
          expected: "111",
          accuracy: "111",
          test: "111",
        },
      ],
 }
}

<style lang="less" scoped>
/deep/ .el-table th {
  overflow: initial;
}
/deep/.el-table th > .cell {
  font-family: PingFangSC-Regular, sans-serif;
  font-size: 14px;
  color: #2e3444;
}

/deep/ .el-table thead tr:first-of-type th:first-of-type,
/deep/ .el-table thead tr:nth-of-type(2) th:first-of-type {
  border-bottom: none;
  padding: 0;
}
/deep/ .el-table thead tr:last-of-type th:first-of-type:before {
  content: "";
  position: absolute;
  width: 1px;
  background-color: #ebeef5;
  display: block;
}
/deep/ .el-table thead tr:last-of-type th:first-of-type:before {
  height: 183px; //根据情况调整
  bottom: 0;
  right: 0; //根据情况调整
  transform: rotate(-72deg); //根据情况调整
  transform-origin: bottom;
}
/deep/ .el-table tbody tr td:first-of-type .cell {
  font-family: PingFangSC-Regular, sans-serif;
  font-size: 14px;
  color: #2e3444;
  font-weight: 600;
  text-align: center;
}
</style>
  • 11
    点赞
  • 47
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值