1,用的el-table,我这里是把选中确认后的数据跟表格中的数据对比,是选中了的数据就set一个字段Confirmed = true,然后:row-class-name来改这一行的颜色,
再:selectable来禁用复选框
<el-table
:max-height="maxTable"
:data="tableData"
style="width: 100%"
@selection-change="handleSelectionChange"
:header-cell-style="{ 'text-align': 'center' }"
:row-class-name="tableRowClassName"
>
<!-- prop='Confirmed' -->
<el-table-column
type="selection"
width="55"
:selectable='checkboxT'
align="center"
>
tableRowClassName({row, rowIndex}) {
if (row.Confirmed == true) {
return 'warning-row';
}else {
return '';
}
},
//复选框
checkboxT(row, rowIndex){
console.log(1832,row)
if (row.Confirmed == true) {
return false;//禁用
}else {
return true;//不禁用
}
},