Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save condorheroblog/557c18c61084a1296b716bcb1203315e to your computer and use it in GitHub Desktop.

Select an option

Save condorheroblog/557c18c61084a1296b716bcb1203315e to your computer and use it in GitHub Desktop.
动态表格中为什么设置 scrollY 为 initial

动态表格中为什么设置 scrollY 为 initial

未设置 scrollY 的时候,antd 的表格布局是纯 table 结构,布局如下:

image

antd 中垂直方向上表格的滚动是通过设置 scrollY 来实现的,设置 scrollY 则会改变 antd table 的 DOM 结构结构如下:

image

前后对比图:

image

设置 scrollY 为任何有效值,则可以使用可滚动表格的结构,然后设置 div.ant-table-body 为合适值即可。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment