element ui 表格头斜对角线

样式如下 


<template>
  <div>
    <el-table :data="tableData" border stripe>
      <el-table-column prop="year" label="类型" width="150" align="center">
        <el-table-column
          prop="year"
          label="序号"
          align="center"
          width="150"
        ></el-table-column>
      </el-table-column>
      <el-table-column
        prop="fenopda"
        label="重量"
        align="center"
      ></el-table-column>
      <el-table-column
        prop="dwaiod"
        label="长度"
        align="center"
      ></el-table-column>
      <el-table-column
        prop="date"
        label="时间"
        align="center"
      ></el-table-column>
      <el-table-column
        prop="name"
        label="负责人"
        align="center"
      ></el-table-column>
      <el-table-column
        prop="province"
        label="产地"
        align="center"
      ></el-table-column>
    </el-table>
  </div>
</template>
 
<script>
export default {
  data() {
    return {
		tableTitle:[{
			
		}],
      //模拟的假数据
      tableData: [
        {
          date: "2016-05-03",
          name: "王小虎",
          province: "上海",
          city: "普陀区",
          address: "上海市普陀区金沙江路",
          zip: 200333,
          dwaiod: "154",
          fenopda: "89",
          year: "1",
        },
        {
          date: "2016-05-03",
          name: "王小虎",
          province: "上海",
          city: "普陀区",
          address: "上海市普陀区金沙江路",
          zip: 200333,
          dwaiod: "154",
          fenopda: "89",
          year: "2",
        },
        {
          date: "2016-05-03",
          name: "王小虎",
          province: "上海",
          city: "普陀区",
          address: "上海市普陀区金沙江路",
          zip: 200333,
          dwaiod: "154",
          fenopda: "89",
          year: "3",
        },
      ],
    };
  },
};
</script>
 
<style>
/* 这里主要的作用就是用来强制修改element默认的样式*/
 .el-table thead.is-group th {
  background: none;
  padding: 0px;
  height: 27.4px;
}
 
 .el-table thead.is-group tr:first-of-type th:first-of-type {
  border-bottom: none; /*中间的横线去掉*/
}
 
 .el-table thead.is-group tr:first-of-type th:first-of-type div.cell {
  text-align: right; /*上边文字靠右*/
}
 
 .el-table thead.is-group tr:last-of-type th:first-of-type div.cell {
  text-align: left; /*下边文字靠左*/
}
/*核心代码*/
 .el-table thead.is-group tr:first-of-type th:first-of-type:before {
  content: "";
  position: absolute;
  width: 1px;
  height: 100px; /*斜线的长度*/
  top: 0;
  left: 0;
  background-color: grey;
  opacity: 0.2;
  display: block;
  transform: rotate(-70deg); /*调整斜线的角度*/
  transform-origin: top;
}
 
 .el-table thead.is-group tr:last-of-type th:first-of-type:before {
  content: "";
  position: absolute;
  width: 1px;
  height: 100px; /*斜线的长度*/
  bottom: 0;
  right: 0;
  background-color: grey;
  opacity: 0.2;
  display: block;
  transform: rotate(-70deg); /*调整斜线的角度*/
  transform-origin: bottom;
}
</style>

  • 3
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值