![](https://i-blog.csdnimg.cn/direct/1757a8c601c74adc8a94ea79d73f8e98.png)
javascript
<el-table class="eltable" ref="multipleTable" :data="tableData" style="margin-top: 50px;width: 100%;"
:row-class-name="tableRowClassName" @row-click="rowClick">
<el-table-column v-for="(item, index) in tableTitleList" :label="item.name" :key="index"
:prop="item.prop" :width="item.width" align="center">
</el-table-column>
</el-table>
方法:
javascript
rowClick(row, column, event) {
console.log(row,column);
this.selectIndex = row.index;
},
// 行选中样式
tableRowClassName({
row,
rowIndex
}) {
row.index = rowIndex
if (rowIndex == this.selectIndex) {
return 'success-row';
}
},
样式:
javascript
::v-deep .success-row {
background-color: #81D3F8 !important;
}