Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@ranwawa
Copy link
Contributor

@ranwawa ranwawa commented Dec 27, 2024

RT

| affixRow | `Array` | | 底部总结行 | |
| itemBadge | [`BadgeSchema`](./badge) | | 行角标配置 | |
| autoFillHeight | `boolean``{height: number}``{maxHeight: number}` | | 内容区域自适应高度,可选择自适应、固定高度和最大高度 | `maxHeight` 需要 `2.8.0` 以上版本 |
| tableFillHeight | `boolean` | `false` | 开启 autoFillHeight 后,表格 table 元素会撑开到父元素高度 | |
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hi,之前的 pr 我没看仔细,这个 tableFillHeight 是不是不需要啊,直接根据 autoFillHeight 来控制好了?如果配置 autoFillHeight 了就是 tableFillHeight 模式,否则还是原来的。这样可以省下一个配置。应该不存在。autoFillHeight 为 true tableFillHeight 为 false 的场景吧,如果是这样,麻烦再改一下

@ranwawa
Copy link
Contributor Author

ranwawa commented Dec 27, 2024

如果根据autoFillHeight来控制,就无法做到向下兼容。
我们假设有这样一个场景,表格只有一行数据,并且设置了autoFillHeight。

在更新之前,效果如下:

image

更新之后,效果如下:

image

也就是说,仅仅是更新了依赖包版本,并未做任何改动,界面发生了变化。这就是破坏性变更

原因分析

css中,tr会自动平分tbody的高度
设置autoFillHeight后,如果table最小高度为父元素高度,那么table中的所有行就会平分tbody的高度,如果只有一行时,这一行的高度就是整个tbody的高度了

问题解决

通过额外的一个变量来控制,table是否需要保持和父元素一样的高度。

@2betop
Copy link
Member

2betop commented Dec 28, 2024

之前那个改动是为了 table的 placeholder(为空的时候) 占满,没有意识到会影响你这个 case,你再看看有没有办法照顾好这两个场景,同时又不要加新的配置项。

@ranwawa ranwawa force-pushed the docs/table-fill-height branch 2 times, most recently from 3a2fc7e to b7b6f6b Compare December 29, 2024 08:17
@ranwawa ranwawa force-pushed the docs/table-fill-height branch from b7b6f6b to 7076c4d Compare December 29, 2024 08:20
@ranwawa
Copy link
Contributor Author

ranwawa commented Dec 29, 2024

之前那个改动是为了 table的 placeholder(为空的时候) 占满,没有意识到会影响你这个 case,你再看看有没有办法照顾好这两个场景,同时又不要加新的配置项。

根据表格是否有数据进行判断,当表格无数据时,默认撑开到父元素高度。代码已修改

@2betop
Copy link
Member

2betop commented Dec 30, 2024

thanks

@hsm-lv hsm-lv merged commit 2747fee into baidu:master Dec 30, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants