diff --git a/frontend/src/pages/front/LandingPage.tsx b/frontend/src/pages/front/LandingPage.tsx index a45fc6f..7790623 100644 --- a/frontend/src/pages/front/LandingPage.tsx +++ b/frontend/src/pages/front/LandingPage.tsx @@ -111,8 +111,8 @@ const LandingPage: React.FC = () => { else window.scrollTo({ top: 0, behavior: 'smooth' }); }; - // HashRouter 下原生 会被当成路由路径解析,导致菜单失效; - // 故改为编程式滚动 + preventDefault,仅在 LandingPage 内部滚动容器内跳转。 + // 页内锚点导航:原生 会触发路由跳转而非滚动, + // 故改为编程式 scrollIntoView + preventDefault,仅在 LandingPage 内部滚动容器内跳转。 const anchorClick = (id: string, after?: () => void) => (e: React.MouseEvent) => { e.preventDefault(); document.getElementById(id)?.scrollIntoView({ behavior: 'smooth', block: 'start' });