|
|
@ -172,8 +172,8 @@ export function useRoute(): Route {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function scrollTo(el: HTMLElement, hash: string, smooth = false) {
|
|
|
|
function scrollTo(el: HTMLElement, hash: string, smooth = false) {
|
|
|
|
const pageOffset = (document.querySelector('.nav-bar') as HTMLElement)
|
|
|
|
const nav = document.querySelector('.nav-bar')
|
|
|
|
.offsetHeight
|
|
|
|
const pageOffset = nav ? (nav as HTMLElement).offsetHeight : 0
|
|
|
|
const target = el.classList.contains('.header-anchor')
|
|
|
|
const target = el.classList.contains('.header-anchor')
|
|
|
|
? el
|
|
|
|
? el
|
|
|
|
: document.querySelector(decodeURIComponent(hash))
|
|
|
|
: document.querySelector(decodeURIComponent(hash))
|
|
|
|