我正在使用我的Angular 项目的antd**NG-ZORRO Table**,所以任何人知道知道如何添加表特殊颜色的背景色?
此处解释图像
这是我的代码
超文本标记语言
<nz-table #basicTable [nzData]="dataSet">
<thead>
<tr>
<th>Name</th>
<th>Age</th>
<th>Address</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let data of basicTable.data">
<td>{{data.name}}</td>
<td>{{data.age}}</td>
<td>{{data.address}}</td>
<td>
<a>Action 一 {{data.name}}</a>
<nz-divider nzType="vertical"></nz-divider>
<a>Delete</a>
</td>
</tr>
</tbody>
</nz-table>
.ts
export class NzDemoTableBasicComponent {
listOfData: Person[] = [
{
key: '1',
name: 'John Brown',
age: 32,
address: 'New York No. 1 Lake Park'
},
{
key: '2',
name: 'Jim Green',
age: 42,
address: 'London No. 1 Lake Park'
},
{
key: '3',
name: 'Joe Black',
age: 32,
address: 'Sidney No. 1 Lake Park'
}
];
}
1条答案
按热度按时间nbysray51#
如果你想动态地做它对象必须改变到这个
我为属性的值加上value,如果我们想要colored col,那么数据数组将如下所示
和HTML代码就像这样
最后的结果会是这样的
您可以在stackblitz中查看here的代码