vue使用element-ui table 清除表格背景色以及表格边框线

  <div class="bkPart statusPart t_btn2">
            <div class="co-title">设备状态div>
            <div class="silo">料仓div>
            // 设置表格背景色,字体颜色以及字体大小
            
            <el-table
              ref="table"
              :header-cell-style="{
                backgroundColor: 'transparent',
                color: '#ffffff',
                fontSize: '9px',
                textAlign: 'center',
              }"
              :cell-style="{
                color: '#fff',
                backgroundColor: 'transparent',
                fontSize: '9px',
                textAlign: 'center',
              }"
              :row-style="{
                color: '#fff',
                backgroundColor: 'transparent',
                fontSize: '9px',
                textAlign: 'center',
              }"
              :data="siloData"
              :default-sort="{ prop: '', order: '' }"
              style="width: 100%"
            >
              <template slot="empty">
                <span style="color: #969799">{{ $t("NeoLight.empty") }}span>
              template>
              <el-table-column prop="posName" label="库位使用率" />
              <el-table-column prop="side" label="今日入库" />
              <el-table-column prop="sdate" label="今日出库" />
              <el-table-column prop="createDate" label="状态" />
            el-table>
          div>

css样式代码

  // 由于是只在本页面修改, 所以必须要用 /deep/ 或者 >>> 才能生效  /deep/ 是深度选择器,可自行百度了解更多
  .t_btn2 >>> .el-table,
  .el-table__expanded-cell {
    background-color: transparent;
  }
  .t_btn2 >>> .el-table tr {
    background-color: transparent !important;
  }
  .t_btn2 >>> .el-table--enable-row-transition .el-table__body td,
  .el-table .cell {
    background-color: transparent;
  }
  .t_btn2 >>> .el-table__row > td {
    border: none;
  }
  .t_btn2 >>> .el-table th.el-table__cell.is-leaf,
  .el-table td.el-table__cell {
    border-bottom: 1px solid #fff !important;
  }
  .t_btn2 >>> .el-table td.el-table__cell {
    border-bottom: 1px solid #fff !important;
  }
  /* 清除底部横线 */
  .el-table::before {
    height: 0px;
  }

最终效果为

vue使用element-ui table 清除表格背景色以及表格边框线_第1张图片

你可能感兴趣的:(vue,修改默认样式,element,vue.js,ui,elementui)