博客
关于我
修改ng-zorro中table对齐及宽度等细节
阅读量:662 次
发布时间:2019-03-15

本文共 910 字,大约阅读时间需要 3 分钟。

在 Angular 项目中使用 Ant Design 表组件来实现表格格式化,可以通过以下配置来实现不同的表格显示效果。

改变对齐方式

默认情况下,Ant Design 表组件的表头和表体内容左对齐。要实现居中对齐,可以通过以下方式设置:

AngusTableComponent { @Component({ selector: 'app-angulartable', templateUrl: 'app/angulartable.html', preserveWhitespaces: false }).کو slou�/member/kcrypto}
{{column.title }} {{column.value }}

修改宽度

如果需要在表头上添加宽度,可以通过 nzWidthConfig 属性来实现:

  • 第一种方式:在 Angular 组件中手动设置宽度
{{ column.title }} {{ column.value }}
  • 第二种方式:使用 nzWidthConfig 配置数组
widthConfig = ['50%', '10%', '30%', '20%'];

没有数据时显示“暂无数据”

可以通过 nzNoResult 属性设置没有数据的提示信息:

取消组件前端分页

如果希望展示全部数据,或者不想使用组件自带的分页功能,可以禁用分页控件遮罩:

定制分页

如果需要使用自定义分页,可以通过 nzPaginationConfig 属性来实现自定义行为:

以下是 ts 类型定义示例:

paginationConfig = {  total: () => totalData.length,  sizes: [10, 20, 50],  showTotal: true,  page: 1,  limit: 10};

通过以上设置,可以实现表格居中对齐、宽度配置、数据无结果提示及自定义分页功能,提升表格的可用性和美观性。

转载地址:http://rbrmz.baihongyu.com/

你可能感兴趣的文章
No qualifying bean of type ‘com.netflix.discovery.AbstractDiscoveryClientOptionalArgs<?>‘ available
查看>>
No resource identifier found for attribute 'srcCompat' in package的解决办法
查看>>
no session found for current thread
查看>>
No static resource favicon.ico.
查看>>
no such file or directory AndroidManifest.xml
查看>>
No toolchains found in the NDK toolchains folder for ABI with prefix: mips64el-linux-android
查看>>
NO.23 ZenTaoPHP目录结构
查看>>
no1
查看>>
NO32 网络层次及OSI7层模型--TCP三次握手四次断开--子网划分
查看>>
NOAA(美国海洋和大气管理局)气象数据获取与POI点数据获取
查看>>
NoClassDefFoundError: org/springframework/boot/context/properties/ConfigurationBeanFactoryMetadata
查看>>
node exporter完整版
查看>>
node HelloWorld入门篇
查看>>
Node JS: < 一> 初识Node JS
查看>>
Node JS: < 二> Node JS例子解析
查看>>
Node Sass does not yet support your current environment: Linux 64-bit with Unsupported runtime(93)解决
查看>>
Node Sass does not yet support your current environment: Windows 64-bit with Unsupported runtime(72)
查看>>
Node 裁切图片的方法
查看>>
node+express+mysql 实现登陆注册
查看>>
Node+Express连接mysql实现增删改查
查看>>