element el-table 设置行高

4,913 阅读1分钟

由于element el-table的默认行高不合适,有时候需要自定义的为el-table设置一下行高

先给table加一个class

        <el-table
          class="tableBox"
          v-loading="loading"
          :data="tableData"
          height="700px"
          :cell-class-name="changeCellClass"
          style="width: 100%;">
          <el-table-column
            fixed
            prop="trading_day"
            label="TradingDay"
            width="120">
          </el-table-column>

再写css

<style lang="scss">
   .tableBox {
     th {
       padding: 0 !important;
       height: 48px;
       line-height: 48px;
     }
     td {
       padding: 0 !important;
       height: 48px;
       line-height: 48px;
     }
   }
</style>