el-table 修改指定單元格樣式


https://www.cnblogs.com/wazy999/archive/2019/11/07/11812653.html

   <el-table
      class="table-tranparent"
      :data="tableData"
      border
      :span-method="arraySpanMethod"
      :cell-style="set_cell_style"
    >
      <el-table-column
  
        align="center"
        prop="name"
        label="加減分標題"
        width="120"
      ></el-table-column>
      <el-table-column :show-overflow-tooltip="true" align="center" prop="name" label="變動事由及原因"></el-table-column>
      <el-table-column
        :show-overflow-tooltip="true"
        align="center"
        prop="name"
        label="類型"
        width="120"
      ></el-table-column>
      <el-table-column align="center" prop="address" label="分值變動" width="120"></el-table-column>
    </el-table>

 

 set_cell_style({ row, column, rowIndex, columnIndex }) {
      console.log(row, "row");
      // if (column.label === "時間") {
      //   return "color:black";
      // }
      // if (column.label === "序號") {
      //   return "color:black";
      // } //這里的medicalCommonName指的是在el-table-column定義的prop中的值
      // if (row.medicalCommonName === "未開葯品") {
      //   return "color:lightgray";
      // }
      if (rowIndex === 2) {
         if (columnIndex === 0) {
           return "width: 100%;text-align: right;";
         }
       }
    }

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM