You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
我发现点击左侧目录,跳转的时候计算位置的时候没有乘以相应的放大倍率,导致滚动的位置不太准确
以下是我的解决方案:在src/components/container/toc.vue
1、乘以容器改变后的倍率
const pageContainer = document.querySelector(
${container} .umo-zoomable-container,
) as HTMLElement
const pageHeader = pageContainer?.querySelector(
'.umo-page-node-header',
) as HTMLElement
if (!nodeElement || !pageContainer || !pageHeader) {
return
}
pageContainer.scrollTo({
top: (nodeElement.offsetTop + pageHeader.offsetHeight)*容器改变后的倍率,
})
2、使用scrollIntoView(最简单)
nodeElement.scrollIntoView({
block: 'start',
})
Beta Was this translation helpful? Give feedback.
All reactions