From e53d6d0d0c5264efa1e8cd3ed53f9593aa5d1b09 Mon Sep 17 00:00:00 2001 From: qkiroc <30946345+qkiroc@users.noreply.github.com> Date: Fri, 1 Nov 2024 18:15:27 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20=E9=94=9A=E7=82=B9=E5=AF=BC=E8=88=AA?= =?UTF-8?q?=E6=A0=87=E8=AF=86=E8=B0=83=E6=95=B4=E4=B8=BAdata-id=20(#11144)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/amis-ui/src/components/AnchorNav.tsx | 4 ++-- .../__snapshots__/AnchorNav.test.tsx.snap | 16 ++++++++-------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/packages/amis-ui/src/components/AnchorNav.tsx b/packages/amis-ui/src/components/AnchorNav.tsx index 16dcf8a5013..5f7e738e164 100644 --- a/packages/amis-ui/src/components/AnchorNav.tsx +++ b/packages/amis-ui/src/components/AnchorNav.tsx @@ -32,7 +32,7 @@ class AnchorNavSectionComponent extends React.PureComponent {children} @@ -98,7 +98,7 @@ export class AnchorNav extends React.Component { @autobind scrollToNav(entries: IntersectionObserverEntry[]) { entries.forEach(entry => { - const key = entry.target.id; + const key = entry.target.getAttribute('data-id'); const currentSection = this.sections.find(item => item.key === key); if (currentSection) { currentSection.isIntersecting = entry.isIntersecting; diff --git a/packages/amis/__tests__/renderers/__snapshots__/AnchorNav.test.tsx.snap b/packages/amis/__tests__/renderers/__snapshots__/AnchorNav.test.tsx.snap index 5815f319cd5..30ca763b50f 100644 --- a/packages/amis/__tests__/renderers/__snapshots__/AnchorNav.test.tsx.snap +++ b/packages/amis/__tests__/renderers/__snapshots__/AnchorNav.test.tsx.snap @@ -55,7 +55,7 @@ exports[`Renderer:anchorNav 1`] = ` >