mirror of
https://gitee.com/LongbowEnterprise/BootstrapBlazor.git
synced 2024-11-30 02:58:37 +08:00
fix(Table): calc table height incorrect when invisible at first render (#3980)
* fix: 修复不可见表格高度计算不正确问题 * refactor: 使用动画帧 api * chore: bump version 8.8.2-beta02
This commit is contained in:
parent
3468812560
commit
e2c60b7a9d
@ -1,7 +1,7 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Razor">
|
||||
|
||||
<PropertyGroup>
|
||||
<Version>8.8.2-beta01</Version>
|
||||
<Version>8.8.2-beta02</Version>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup Condition="'$(TargetFramework)' == 'net5.0'">
|
||||
|
@ -190,6 +190,9 @@ export function dispose(id) {
|
||||
Data.remove(id)
|
||||
|
||||
if (table) {
|
||||
if (table.loopCheckHeightHandler) {
|
||||
cancelAnimationFrame(table.loopCheckHeightHandler);
|
||||
}
|
||||
if (table.thead) {
|
||||
EventHandler.off(table.body, 'scroll')
|
||||
}
|
||||
@ -243,6 +246,17 @@ const setColumnToolboxListener = table => {
|
||||
}
|
||||
}
|
||||
|
||||
const check = table => {
|
||||
const el = table.el;
|
||||
if (isVisible(el) === false) {
|
||||
table.loopCheckHeightHandler = requestAnimationFrame(() => check(table));
|
||||
}
|
||||
else {
|
||||
delete table.loopCheckHeightHandler;
|
||||
setBodyHeight(table);
|
||||
}
|
||||
};
|
||||
|
||||
const setBodyHeight = table => {
|
||||
const el = table.el
|
||||
const children = [...el.children]
|
||||
@ -250,6 +264,7 @@ const setBodyHeight = table => {
|
||||
table.search = search;
|
||||
|
||||
if (isVisible(el) === false) {
|
||||
table.loopCheckHeightHandler = requestAnimationFrame(() => check(table));
|
||||
return;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user