antd Table设置固定高度

antd 的 table 高度是根据数据条数来渲染撑高的。

碰到领导要求,table有个固定高度,因为数据只有一两条的时候界面难看。然后在antd的https://github.com/ant-design/ant-design/issues?utf8=%E2%9C%93&q=table+scroll 上搜索了都没有找到合适的。就自己整了骚操作。

修改样式。

给.ant-table设置最低高度。

  .ant-table {
    min-height: 352px !important;
  }

当表格数据为空时,修改.ant-empty-normal样式,会撑高空白样式

  .ant-empty-normal {
    margin: 140px 0 !important;
  }

当然这是为了解决问题而解决问题的办法。

  

猜你喜欢

转载自www.cnblogs.com/thhj-IT/p/11164889.html