From ef3b3c6314b2535b370d36387c09c659a4f633aa Mon Sep 17 00:00:00 2001 From: 2betop <2betop.cn@gmail.com> Date: Wed, 14 Jun 2023 21:02:44 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E4=BA=8C=E7=BA=A7?= =?UTF-8?q?=E5=BC=B9=E7=AA=97=E8=A1=A8=E6=A0=BC=E8=A1=A8=E5=A4=B4=E5=9B=BA?= =?UTF-8?q?=E9=A1=B6=E4=BD=8D=E7=BD=AE=E4=B8=8D=E6=AD=A3=E7=A1=AE=E9=97=AE?= =?UTF-8?q?=E9=A2=98=20Close:=20#7153?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../renderers/__snapshots__/CRUD.test.tsx.snap | 2 -- .../renderers/__snapshots__/Pagination.test.tsx.snap | 1 - .../renderers/__snapshots__/Table.test.tsx.snap | 12 ------------ packages/amis/src/renderers/Table/index.tsx | 9 ++++++++- 4 files changed, 8 insertions(+), 16 deletions(-) diff --git a/packages/amis/__tests__/renderers/__snapshots__/CRUD.test.tsx.snap b/packages/amis/__tests__/renderers/__snapshots__/CRUD.test.tsx.snap index c1143cfc3..19e07dfd4 100644 --- a/packages/amis/__tests__/renderers/__snapshots__/CRUD.test.tsx.snap +++ b/packages/amis/__tests__/renderers/__snapshots__/CRUD.test.tsx.snap @@ -1880,7 +1880,6 @@ exports[`Renderer: crud sortable & orderBy & orderDir & orderField 1`] = `
{ return; } - this.affixDetect(); + requestAnimationFrame(this.affixDetect); parent.addEventListener('scroll', this.affixDetect); window.addEventListener('resize', this.affixDetect); this.updateAutoFillHeight(); @@ -1162,6 +1162,13 @@ export default class Table extends React.Component { const ns = this.props.classPrefix; const dom = findDOMNode(this) as HTMLElement; const clip = (this.table as HTMLElement).getBoundingClientRect(); + + // 还在动画中,跳过。过一会再试。 + if (this.table.offsetWidth && clip.width / this.table.offsetWidth < 0.5) { + setTimeout(this.affixDetect, 200); + return; + } + const offsetY = this.props.affixOffsetTop ?? this.props.env.affixOffsetTop ?? 0; const headingHeight =