fix: emit prevented hashchange event

pull/392/head
Evan You 3 years ago
parent f079a22049
commit 4fb387d94e

@ -133,6 +133,8 @@ export function createRouter(
// scroll between hash anchors in the same page
if (hash && hash !== currentUrl.hash) {
history.pushState(null, '', hash)
// still emit the event so we can listen to it in themes
window.dispatchEvent(new Event('hashchange'))
// use smooth scroll when clicking on header anchor links
scrollTo(link, hash, link.classList.contains('header-anchor'))
}

Loading…
Cancel
Save