Skip to content

Table use FIXED height (表格固定高度) #1471

@a272121742

Description

@a272121742
  • I have searched the issues of this repository and believe that this is not a duplicate.

What problem does this feature solve?

很多情况下,表格在加载过程中,从会很小的矩形变化成大矩形再显示数据。又或者是pageSize为10的时候,最后一页只有2条数据时,表格会收缩成小矩形。我觉得表格可以增加一个固定高度的配置,这个配置会根据表格行(rows)来计算高度,无论你是用了size="middle"或者size="small",都能固定显示pageSize所定义的行数。这样,不会因为数据量不够或者处于第一次加载时,表格忽高忽低,页面元素出现跳动。

What does the proposed API look like?

props: {
  fixed: {
    type: [Boolean, Number],
    default: false
  }
}

如果fixed为Boolean,自动计算fixed高度,例如:预计显示10行,但只有2行数据时,补齐8行。无论size配置何属性都会自动计算。

如果fixed为Number,则表示采用开发者定义的高度进行固定高度填充,例如,:fixed="55",则表格行的总高度就是pageSize * fixed

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions