改回导航栏跳转
This commit is contained in:
parent
21cd091231
commit
b1937c2cfe
|
|
@ -44,15 +44,15 @@ export function TopNav({
|
||||||
}
|
}
|
||||||
|
|
||||||
// 如果有对应的 sectionId,则滚动到该区域
|
// 如果有对应的 sectionId,则滚动到该区域
|
||||||
if (item.sectionId) {
|
// if (item.sectionId) {
|
||||||
const element = document.getElementById(item.sectionId);
|
// const element = document.getElementById(item.sectionId);
|
||||||
if (element) {
|
// if (element) {
|
||||||
element.scrollIntoView({
|
// element.scrollIntoView({
|
||||||
behavior: 'smooth', // 平滑滚动
|
// behavior: 'smooth', // 平滑滚动
|
||||||
block: 'start' // 滚动到顶部对齐
|
// block: 'start' // 滚动到顶部对齐
|
||||||
});
|
// });
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
onItemClick?.(item.key);
|
onItemClick?.(item.key);
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue