el-table 表格表头、单元格、滚动条样式修改

.2023.11.21今天我学习了如何对el-table表格样式进行修改,如图:

运用的两个样式主要是

1.header-cell-class-name(设置表头)

2.class-name(设置行单元格)

代码如下:

<el-table :data="typeList"
                class="real_operation_table"
                :header-cell-class-name="'header_name_style'">
        <el-table-column :class-name="'all_cell_style'" align="center" v-for="(value, key) in typeList[0]" :key="key"
                         :prop="key">
          <template slot="header" slot-scope="scope">
            <span>{{ value.name }}</span>
          </template>
          <template slot-scope="scope">
            <span>{{ scope.row[key].value }}</span>
          </template>
        </el-table-column>
      </el-table>

.el-table如果有class记得换成自己的类名 ,没有就直接用el-table

//添加表头表格颜色
::v-deep .header_name_style {
  background-color: rgb(4, 62, 114) !important;
  color: #4cd0ee;
  font-size: 20px;
}

//添加单元格背景颜色
::v-deep .all_cell_style {
  background-color: rgb(5, 35, 61);
  color: #4cd0ee;
  font-size: 20px;
}

//去掉表格底部边框
.real_operation_table::before {
  width: 0;
}

//去掉单元格边框
::v-deep .real_operation_table .el-table__cell {
  border: none !important;
}

::v-deep .el-table--scrollable-y .el-table__body-wrapper {
  background-color: rgb(5, 35, 61);
}

::v-deep .real_operation_table .el-table__cell.gutter {
  background-color: rgb(6, 71, 128) !important;
}

//鼠标移入效果
::v-deep.real_operation_table {
  // 每行鼠标经过得样式
  .el-table__body tr:hover > td {
    background-color: rgb(5, 35, 61) !important;
  }

  .el-table__body tr.current-row > td {
    background-color: rgb(5, 35, 61) !important;
  }
}

// 滚动条样式
::v-deep ::-webkit-scrollbar {
  width: 0.4vh;
}

::v-deep ::-webkit-scrollbar-track {
  background-color: transparent;
}

::v-deep ::-webkit-scrollbar-thumb {
  background-color: rgb(68, 148, 220);
  border-radius: 4px;
}

//去掉表格背景颜色
::v-deep .el-table {
  background-color: transparent !important;
}

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

敲代码无敌小奶龙

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值