效果图如下:
首先
首先:需要在表格行加入 标签
{{ row.usable ==true ? "启用" : "停用"}}
2.在methods里面加入这个方法:
fontLightClass(usable){
if(usable == true){
return 'fgreen'
}else{
return 'fred'
}
},
3.去设置自己喜欢的颜色:
.fred {
color: red;
}
.fgreen {
color: green;
}
//还有另一种(这种后端返回的数据里面带有背景色的字段)
:style="{
marginLeft: 18 + '%',
textAlign: 'center',
width: 98 + 'px',
color: '#333333 !important',
backgroundColor: 'rgb(' + row.color_value + ')',
}">
文章来源
发表评论