el-table設置單元格里的字體顏色

例如圖中,設置某個單元格的字體顏色:

① el-table標籤上添加屬性::cell-style=“cellStyle”

<el-table :data="tableData" :cell-style="cellStyle" border stripe fit>

 

②vue文件裏在method裏聲明 cellStyle方法

 cellStyle({ row, column, rowIndex, columnIndex }) {
      if (columnIndex === 0 || columnIndex === 1) {
        return "font-weight:700;color:#FF6100 ";
      }
      return "";
    }
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章