chore(frontend): 清理 LandingPage 中关于 HashRouter 的历史注释(项目已迁 BrowserRouter)
This commit is contained in:
1 parent
d404aa4e29
commit
c7fea64ae7
1 file changed
+2
-2
@@ -111,8 +111,8 @@ const LandingPage: React.FC = () => {
|
||||
else window.scrollTo({ top: 0, behavior: 'smooth' });
|
||||
};
|
||||
|
||||
// HashRouter 下原生 <a href="#id"> 会被当成路由路径解析,导致菜单失效;
|
||||
// 故改为编程式滚动 + preventDefault,仅在 LandingPage 内部滚动容器内跳转。
|
||||
// 页内锚点导航:原生 <a href="#id"> 会触发路由跳转而非滚动,
|
||||
// 故改为编程式 scrollIntoView + preventDefault,仅在 LandingPage 内部滚动容器内跳转。
|
||||
const anchorClick = (id: string, after?: () => void) => (e: React.MouseEvent) => {
|
||||
e.preventDefault();
|
||||
document.getElementById(id)?.scrollIntoView({ behavior: 'smooth', block: 'start' });
|
||||
|
||||
Reference in new issue
Block a user