<el-table header-align="center" :cell-style="cellStyle" stripe highlight-current-row :data="Listform.tableData">
<!-- <el-table-column prop="id" align="center" label="序号" width="40">
</el-table-column> -->
<el-table-column prop="checkName" align="center" label="点检项目" width="80">
</el-table-column>
<el-table-column prop="checkBase" align="center" label="点检基准" width="110">
</el-table-column>
<el-table-column prop="checkMethod" align="center" label="点检方法" width="80">
</el-table-column>
<el-table-column prop="cleanMethod" align="center" label="清扫方法" width="80">
</el-table-column>
<el-table-column prop="cycleTime" align="center" label="周期" width="60">
</el-table-column>
<el-table-column prop="shift" align="center" label="班次" width="60">
</el-table-column>
<el-table-column class="end" prop="checkType" align="center" label="点检结果" width="120">
<template slot-scope="scope">
<el-form-item :prop="'tableData.' + scope.$index + '.checkType'" :rules="rules.checkType"
class="end-form-item">
<el-radio v-model="scope.row.checkType" label="Y" style="display: inline;margin: 0;"
@change="handleRowCheckTypeY(scope.$index)">是
</el-radio>
<el-radio v-model="scope.row.checkType" label="N" style="display: inline;margin: 0;"
@change="handleRowCheckTypeN(scope.$index)">否
</el-radio>
</el-form-item>
</template>
</el-table-column>
<el-table-column prop="operation" align="center" label="操作" width="120">
<template slot-scope="scope">
<el-button size="mini" class="btns" type="primary" @click="handleOpenModal(scope.$index)" plain icon="el-icon-edit">异常上报
</el-button>
</template>
</el-table-column>
</el-table>
主要用到element-ui一个事件可以修改样式
在方法里面添加判断
cellStyle(row,column,rowIndex,columnIndex){
console.log(row)
console.log(row.column)
if (row.row.checkType==="Y") {
return 'color:rgb(7,193,76)'
}else if(row.row.checkType==="N"){
return 'color:red'
}
},
参考文章https://blog.csdn.net/qq_32610671/article/details/90731672