我必须根据表中的结果列为 false 添加红色背景颜色,为 true 添加绿色背景,我使用 elementUI + 数据表分页 + vuejs。我尝试通过在结果列上使用样式绑定来添加列声明,提前致谢
我的模板代码
<template slot="header" slot-scope="table" :style = "customRowBackground(table.row)">
<template slot-scope="table">{{ table.row.launch_success }}</template>
</el-table-column>
Run Code Online (Sandbox Code Playgroud)
我的 customRowBackgrond() 函数
customRowBackgrond({row}){
if (row.launch_success == true) {
return {'backgrondColor': 'rgb(252, 230, 190)'};
}
else if (row.launch_success == false) {
return { backgrondColor: 'rgb(252, 230, 190)'};
}
else {
return {backgrondColor: 'rgb(252, 230, 190)'};
}
},
Run Code Online (Sandbox Code Playgroud)
我需要在我的整个表中获得绿色的真实值和红色的假值......提前致谢。