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;";
         }
       }
    }

 

posted @ 2020-07-20 10:08  ThisCall  阅读(2046)  评论(0编辑  收藏  举报