Elment-ui的多个样式修改

Elment-ui的多个样式修改

一、修改elment-ui的表格样式

1、修改鼠标移动到表格row行的 hover效果

/* 以less语法为例 */
/deep/ .el-table__row {
  &:hover {
    color: #5aa6d4;
    box-shadow: inset 0 0px 6px 2px #00bae4;
    font-weight: 700;
    font-size: 14px;
  }
}

2、修改table表格不对齐

.body .el-table th.gutter {
  display: table-cell !important;
}

Elment-ui的多个样式修改
3、删除table表格边框线

<template>
  <div class="todaySchedule">
    <el-table :data="tableData" style="width: 100%" class="customer-table" :header-row-style="{ background:'transparent !important'}" :row-class-name="tableRowClassName"  :header-cell-style="{background:'#052c55',color:'blue',border:'none',padding:'5px 0'}">
      <el-table-column prop="date" label="日期" show-overflow-tooltip> </el-table-column>
      <el-table-column prop="name" label="姓名" show-overflow-tooltip> </el-table-column>
      <el-table-column prop="address" label="地址" show-overflow-tooltip> </el-table-column>
    </el-table>
  </div>
</template>

.customer-table th{
    border:none;
  }
.customer-table td,.customer-table th.is-leaf {
  border:none;
}
// 表格最外边框
.el-table--border, .el-table--group{
  border: none;
}
// 头部边框
.customer-table thead tr th.is-leaf{
  // border: 1px solid #EBEEF5;
  border-right: none;
}
// 表格最外层边框-底部边框
.el-table--border::after, .el-table--group::after{
  width: 0;
}
.customer-table::before{
  width: 0;
}
.customer-table .el-table__fixed-right::before,.el-table__fixed::before{
  width: 0;
}

4、修改table的行padding大小

/deep/ .el-table td, .el-table th{
  padding: 5px 0 !important;
  background-color: transparent !important;
}

5、通过table属性::row-class-name=“tableRowClassName”,修改每一行的背景颜色

 methods: {
    tableRowClassName({ row, rowIndex }) {
      if (rowIndex % 2 === 0) {
        return "odd-row"
      }
      return "add-row"
    },
  },
/deep/ .el-table .add-row {
  background-color: #052c55;
}
/deep/ .el-table .odd-row {
  background-color: #060f29;
}
上一篇:C++常用字符串分割方法(转)


下一篇:codeforce 359D 二分+ 动态规划(sparse table)