angular - 调整Nz-Table动态列中某些列的宽度

标签 angular antd ng-zorro-antd

我正在使用 Nz-Zorro ie; ng-antd 设计表。这里我动态调用表头。

我有 4 列,我想通过名称减少 2 列的宽度。我怎样才能做到这一点?

<thead>
   <tr>
     <th *ngFor="let column of listOfColumns">
       {{ column.name }}
     </th>
   </tr>
</thead>

最佳答案

您可以将 colWidth: "string" 属性添加到每个 listOfColumns 项的类中,并使用模型键在模型中更改它。然后使用[nzWidth]更改列宽:

<thead>
   <tr>
     <th  *ngFor="let column of listOfColumns" [nzWidth]="column.colWidth">
       {{ column.name }}
     </th>
   </tr>
</thead>

关于angular - 调整Nz-Table动态列中某些列的宽度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/68757275/

相关文章:

angular - 在 angular 2 组件中使用 rxjs,我应该手动导入运算符吗?

angular - 如何将 formControlName 赋予 FormArray 对象 - Angular 2 (ReactiveFormsModule)

javascript - 使用 React 中的 Ant Design 在选项卡中切换选项卡的按钮?

reactjs - React Ant设计文件上传仅xls文件验证

css - antd 中的子菜单项不可滚动

Angular 7 生产构建失败

angular - 获取 "' 组件'不是已知元素“angular2 中的错误

java - 如何将 Angular 4 应用程序与 Spring Boot 堆栈集成?