Skip to content

Commit 5ca9883

Browse files
daohoangsonyyx990803
authored andcommitted
Fix hash-mode replaceHash() when page has a <base href />
1 parent ba05490 commit 5ca9883

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/history/hash.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,10 @@ function pushHash (path) {
9090
}
9191

9292
function replaceHash (path) {
93-
const i = window.location.href.indexOf('#')
93+
const href = window.location.href
94+
const i = href.indexOf('#')
95+
9496
window.location.replace(
95-
window.location.href.slice(0, i >= 0 ? i : 0) + '#' + path
97+
window.location.href.slice(0, i >= 0 ? i : href.length) + '#' + path
9698
)
9799
}

0 commit comments

Comments
 (0)