fix: use redirect instead

pull/853/head
JounQin 3 years ago
parent f522cdaec4
commit 69c4773585

@ -42,12 +42,9 @@ export function createRouter(
function go(href: string = inBrowser ? location.href : '/') { function go(href: string = inBrowser ? location.href : '/') {
// ensure correct deep link so page refresh lands on correct files. // ensure correct deep link so page refresh lands on correct files.
const url = new URL(href, fakeHost) const url = new URL(href, fakeHost)
if ( if (!url.pathname.endsWith('/') && !url.pathname.endsWith('.html')) {
!url.pathname.endsWith('/') && url.pathname +=
!url.pathname.endsWith('.html') && url.pathname + '/' === siteDataRef.value.base ? '/' : '.html'
url.pathname + '/' !== siteDataRef.value.base
) {
url.pathname += '.html'
href = url.pathname + url.search + url.hash href = url.pathname + url.search + url.hash
} }
if (inBrowser) { if (inBrowser) {

Loading…
Cancel
Save