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 "";
    }
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章