antd scroll table vertical scroll bar problem

problem scenario

When using antd with a scroll bar, sometimes when tbodythe height ≤ yvalue, the vertical scroll bar will only leave the scroll bar background, and the scroll bar will disappear (as shown below) (sometimes the empty state will also have problems); only when When tbodythe height of is higher than ythe value, the vertical scroll bar will be displayed normally. If the style of the scroll bar is modified in the project, there may be unsightly problems.

insert image description here

  <Table
    columns={
    
    columns}
    dataSource={
    
    data}
    scroll={
    
    {
    
    
      x: 1500,
      y: 500
    }}
  />

Causes and Solutions

The overflow in antd is:

overflow: auto scroll;

The y-axis scrollis causing the problem.

Just change the properties of the y-axis as well auto.

.ant-table-body {
    
    
	overflow: auto !important;
}

Guess you like

Origin blog.csdn.net/Charonmomo/article/details/128034545