We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 019b539 commit b39f2b2Copy full SHA for b39f2b2
components/anchor/Anchor.tsx
@@ -131,8 +131,6 @@ export default defineComponent({
131
const { offsetTop, targetOffset } = props;
132
133
setCurrentActiveLink(link);
134
- const container = getContainer.value();
135
- const scrollTop = getScroll(container, true);
136
const sharpLinkMatch = sharpMatcherRegx.exec(link);
137
if (!sharpLinkMatch) {
138
return;
@@ -142,6 +140,8 @@ export default defineComponent({
142
140
143
141
}
144
+ const container = getContainer.value();
+ const scrollTop = getScroll(container, true);
145
const eleOffsetTop = getOffsetTop(targetElement, container);
146
let y = scrollTop + eleOffsetTop;
147
y -= targetOffset !== undefined ? targetOffset : offsetTop || 0;
0 commit comments