改回导航栏跳转
This commit is contained in:
parent
21cd091231
commit
b1937c2cfe
|
|
@ -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);
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in New Issue