From a59081ea552ca7129c0237f45d51239e0783b18e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E9=82=93?= <35675081+mySkey@users.noreply.github.com> Date: Thu, 30 May 2024 20:49:30 +0800 Subject: [PATCH] fix: Anchor - The replace attribute causes no scrolling animation (#49136) Co-authored-by: dengxia --- components/anchor/AnchorLink.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/anchor/AnchorLink.tsx b/components/anchor/AnchorLink.tsx index deb2968ceb..2aaf4f6d5f 100644 --- a/components/anchor/AnchorLink.tsx +++ b/components/anchor/AnchorLink.tsx @@ -42,12 +42,12 @@ const AnchorLink: React.FC = (props) => { }, [href]); const handleClick = (e: React.MouseEvent) => { + onClick?.(e, { title, href }); + scrollTo?.(href); if (replace) { e.preventDefault(); window.location.replace(href); } - onClick?.(e, { title, href }); - scrollTo?.(href); }; // =================== Warning =====================