el-table设置边框颜色

需求的边框颜色是透明的

1.设置表头的边框颜色

在el-table标签分别绑定两函数

:cell-style="tableCellStyle"

:header-cell-style="tableHeaderCellStyle"

        <el-table
          v-if="tableData.length !== 0"
          :cell-style="tableCellStyle"
          :header-cell-style="tableHeaderCellStyle"
          :data="tableData"
          style="width: 100%;"
        >
          <el-table-column prop="name" label="规则名称" />
          <el-table-column prop="example" label="示例" />
          <el-table-column prop="remark" label="备注">
            <template slot-scope="scope">
              <div class="remark">{{ scope.row.remark }}</div>
            </template>
          </el-table-column>
          <el-table-column label="操作">
            <template slot-scope="scope">
              <div class="operation" @click="toRuleDetails(scope.row)">
                <img class="eyeIcon" src="@/static/icons/eye.png" alt="">
                <span>查看</span>
              </div>
            </template>
          </el-table-column>
        </el-table>

2.在methods写绑定的两方法

    // 修改 table cell边框的背景色
    tableCellStyle() {
      return 'border-color: transparent;'
    },
    // 修改 table header cell的背景色
    tableHeaderCellStyle() {
      return 'border-color: transparent;'
    },

3.在style中设置el-table下边框颜色

/* 表格下边框颜色 */
.el-table--border::after,
.el-table--group::after,
.el-table::before {
  background-color: transparent;
}

4.效果如下

  • 4
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值