mirror of https://github.com/nuxt/nuxt.git
fix(nuxt): swallow issues with query selectors (#8843)
This commit is contained in:
parent
14307d1327
commit
453ce78300
|
@ -48,10 +48,12 @@ export default <RouterConfig> {
|
|||
}
|
||||
|
||||
function _getHashElementScrollMarginTop (selector: string): number {
|
||||
const elem = document.querySelector(selector)
|
||||
if (elem) {
|
||||
return parseFloat(getComputedStyle(elem).scrollMarginTop)
|
||||
}
|
||||
try {
|
||||
const elem = document.querySelector(selector)
|
||||
if (elem) {
|
||||
return parseFloat(getComputedStyle(elem).scrollMarginTop)
|
||||
}
|
||||
} catch {}
|
||||
return 0
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue