vue+elementUI中表格高亮或字體顏色改變

重點的代碼:

:row-style="setRowStyle"這個屬性就是在table標籤綁定的

:row-style="setRowStyle"

setRowStyle(row) {
          if (row.row.isPart == true) {
              return 'color:blue;'
          }
        },

具體代碼:

hmtl

<el-table width="100%" :data="gridData" border fit highlight-current-row :header-cell-style="{background:'#199ED8'}" :row-style="setRowStyle">
  <el-table-column label="序號" type="index"></el-table-column>
 </el-table>

js中就是方法的調用就好了

setRowStyle(row) {
          if (row.row.isPart == true) {
              return 'color:blue;'
          }
        },
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章