element Table 根据条件动态添加行样式

鼠标移上去上面显示

选择器:hover{
cursor: pointer;
}

根据条件动态添加行样式


<el-table
v-loading="loading"
:data="deptList"
row-key="deptId"
:row-class-name="tableRowClassNamssse"

highlight-current-row
@current-change="handleCurrentChange"
:tree-props="{children: 'children', hasChildren: 'hasChildren'}"
>

  
//定义的方法
tableRowClassNamssse({ row, rowIndex }) { row.row_index
= rowIndex; if(this.currentRow.row_index===rowIndex){ return "tableSelectedRowBgColor"; } return ""; },

.tableSelectedRowBgColor td {
background-color: #80b9ee !important;
cursor: pointer;
}

 

 

posted @ 2022-08-24 15:42  逝年的我们  阅读(635)  评论(0编辑  收藏  举报