博客
关于我
修改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/

你可能感兴趣的文章
npm学习(十一)之package-lock.json
查看>>
npm安装 出现 npm ERR! code ETIMEDOUT npm ERR! syscall connect npm ERR! errno ETIMEDOUT npm ERR! 解决方法
查看>>
npm安装crypto-js 如何安装crypto-js, python爬虫安装加解密插件 找不到模块crypto-js python报错解决丢失crypto-js模块
查看>>
npm安装教程
查看>>
npm报错Cannot find module ‘webpack‘ Require stack
查看>>
npm报错Failed at the node-sass@4.14.1 postinstall script
查看>>
npm报错fatal: Could not read from remote repository
查看>>
npm报错File to import not found or unreadable: @/assets/styles/global.scss.
查看>>
npm报错unable to access ‘https://github.com/sohee-lee7/Squire.git/‘
查看>>
npm淘宝镜像过期npm ERR! request to https://registry.npm.taobao.org/vuex failed, reason: certificate has ex
查看>>
npm版本过高问题
查看>>
npm的“--force“和“--legacy-peer-deps“参数
查看>>
npm的安装和更新---npm工作笔记002
查看>>
npm的常用配置项---npm工作笔记004
查看>>
npm的问题:config global `--global`, `--local` are deprecated. Use `--location=global` instead 的解决办法
查看>>
npm编译报错You may need an additional loader to handle the result of these loaders
查看>>
npm设置淘宝镜像、升级等
查看>>
npm设置源地址,npm官方地址
查看>>
npm设置镜像如淘宝:http://npm.taobao.org/
查看>>
npm配置安装最新淘宝镜像,旧镜像会errror
查看>>