1.用ngIf来判断
<td class="center" *ngIf="data.status === '红码' " style="color:red">{{data.status}}</td>
2.函数来判断
<td class="center" :style="changeColor(data.status)">{{data.status}}</td>
changeColor(codeColor:any) {
let color = '';
if (codeColor === '红码')
color = '#ff0000'
else if (codeColor === '黄码')
color = '#ffcf10'
else
color = '#00ff2f'
return {
color: color
}
}