表格
<el-table:data="data"
:row-class-name="tableRowClassName" //设置类
:row-style="selectedstyle" //设置行的样式
@row-click="rowClick" //点击>
</el-table>
data() {
return {
data:[],
getIndex:"",
}
},
methods: {
selectedstyle ({row, rowIndex}) {
if ((this.getIndex) === rowIndex ) {
return { "background-color": "#2D5CFF" };
}
},
tableRowClassName ({row, rowIndex}) {
row.index = rowIndex;
},
rowClick (row) {
this.getIndex=row.index
}
}