fix(client): no onAfterRouteChanged called after popstate (#3227)

closes #3226
pull/3248/head
DY_XiaoDong 11 months ago committed by GitHub
parent ef6d8d1e42
commit 60fc8fd244
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -222,11 +222,12 @@ export function createRouter(
{ capture: true } { capture: true }
) )
window.addEventListener('popstate', (e) => { window.addEventListener('popstate', async (e) => {
loadPage( await loadPage(
normalizeHref(location.href), normalizeHref(location.href),
(e.state && e.state.scrollPosition) || 0 (e.state && e.state.scrollPosition) || 0
) )
router.onAfterRouteChanged?.(location.href)
}) })
window.addEventListener('hashchange', (e) => { window.addEventListener('hashchange', (e) => {

Loading…
Cancel
Save