|
|
@ -104,8 +104,8 @@ export function createRouter(
|
|
|
|
if (targetLoc.hash && !scrollPosition) {
|
|
|
|
if (targetLoc.hash && !scrollPosition) {
|
|
|
|
let target: HTMLElement | null = null
|
|
|
|
let target: HTMLElement | null = null
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
target = document.querySelector(
|
|
|
|
target = document.getElementById(
|
|
|
|
decodeURIComponent(targetLoc.hash)
|
|
|
|
decodeURIComponent(targetLoc.hash).slice(1)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
} catch (e) {
|
|
|
|
} catch (e) {
|
|
|
|
console.warn(e)
|
|
|
|
console.warn(e)
|
|
|
@ -238,7 +238,7 @@ export function scrollTo(el: Element, hash: string, smooth = false) {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
target = el.classList.contains('header-anchor')
|
|
|
|
target = el.classList.contains('header-anchor')
|
|
|
|
? el
|
|
|
|
? el
|
|
|
|
: document.querySelector(decodeURIComponent(hash))
|
|
|
|
: document.getElementById(decodeURIComponent(hash).slice(1))
|
|
|
|
} catch (e) {
|
|
|
|
} catch (e) {
|
|
|
|
console.warn(e)
|
|
|
|
console.warn(e)
|
|
|
|
}
|
|
|
|
}
|
|
|
|