改回导航栏跳转

This commit is contained in:
Li1304553726 2025-11-20 11:34:36 +08:00
parent 21cd091231
commit b1937c2cfe
1 changed files with 9 additions and 9 deletions

View File

@ -44,15 +44,15 @@ export function TopNav({
}
// 如果有对应的 sectionId则滚动到该区域
if (item.sectionId) {
const element = document.getElementById(item.sectionId);
if (element) {
element.scrollIntoView({
behavior: 'smooth', // 平滑滚动
block: 'start' // 滚动到顶部对齐
});
}
}
// if (item.sectionId) {
// const element = document.getElementById(item.sectionId);
// if (element) {
// element.scrollIntoView({
// behavior: 'smooth', // 平滑滚动
// block: 'start' // 滚动到顶部对齐
// });
// }
// }
onItemClick?.(item.key);
};