mirror of
https://github.com/ant-design/ant-design.git
synced 2025-06-11 03:22:59 +08:00
fix: Anchor - The replace attribute causes no scrolling animation (#49136)
Co-authored-by: dengxia <dengxia@tanqingsk.com>
This commit is contained in:
parent
72791d16f3
commit
a59081ea55
@ -42,12 +42,12 @@ const AnchorLink: React.FC<AnchorLinkProps> = (props) => {
|
|||||||
}, [href]);
|
}, [href]);
|
||||||
|
|
||||||
const handleClick = (e: React.MouseEvent<HTMLAnchorElement, MouseEvent>) => {
|
const handleClick = (e: React.MouseEvent<HTMLAnchorElement, MouseEvent>) => {
|
||||||
|
onClick?.(e, { title, href });
|
||||||
|
scrollTo?.(href);
|
||||||
if (replace) {
|
if (replace) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
window.location.replace(href);
|
window.location.replace(href);
|
||||||
}
|
}
|
||||||
onClick?.(e, { title, href });
|
|
||||||
scrollTo?.(href);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// =================== Warning =====================
|
// =================== Warning =====================
|
||||||
|
Loading…
Reference in New Issue
Block a user