例如圖中,設置某個單元格的字體顏色:
① 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 "";
}