correct fix

pull/3637/head
Divyansh Singh 2 years ago
parent 59e1773623
commit 631e4418eb

@ -180,7 +180,7 @@ export function createRouter(
: link.href,
link.baseURI
)
const currentUrl = window.location
const currentUrl = new URL(window.location.href) // copy to keep old data
// only intercept inbound html links
if (
!e.ctrlKey &&
@ -211,7 +211,12 @@ export function createRouter(
window.scrollTo(0, 0)
}
} else {
go(href)
go(href).then(() => {
// do after the route is changed so location.hash in theme code is the new hash
if (hash !== currentUrl.hash) {
window.dispatchEvent(new Event('hashchange'))
}
})
}
}
}

@ -1,4 +1,4 @@
import { computed, watch } from 'vue'
import { computed } from 'vue'
import { ensureStartingSlash } from '../support/utils'
import { useData } from './data'
import { hashRef } from './hash'
@ -15,10 +15,6 @@ export function useLangs({
(localeIndex.value === 'root' ? '/' : `/${localeIndex.value}/`)
}))
watch(page, () => {
hashRef.value = location.hash ? location.hash : ''
})
const localeLinks = computed(() =>
Object.entries(site.value.locales).flatMap(([key, value]) =>
removeCurrent && currentLang.value.label === value.label

Loading…
Cancel
Save