fix(nuxt): consider doc `scroll-padding-top` in scrollBehavior (#28083)

This commit is contained in:
BoogieBen 2024-07-12 21:13:24 +08:00 committed by GitHub
parent 53ab4ef052
commit 48a8b18083
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 1 additions and 1 deletions

View File

@ -58,7 +58,7 @@ function _getHashElementScrollMarginTop (selector: string): number {
try { try {
const elem = document.querySelector(selector) const elem = document.querySelector(selector)
if (elem) { if (elem) {
return Number.parseFloat(getComputedStyle(elem).scrollMarginTop) return Number.parseFloat(getComputedStyle(elem).scrollMarginTop) + Number.parseFloat(getComputedStyle(document.documentElement).scrollPaddingTop)
} }
} catch { } catch {
// ignore any errors parsing scrollMarginTop // ignore any errors parsing scrollMarginTop