Skip to content

Commit

Permalink
fix(html5): initial path in HTML5 vs base (vuejs#3555)
Browse files Browse the repository at this point in the history
  • Loading branch information
eyedean committed May 20, 2021
1 parent af538e0 commit d976211
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/history/html5.js
Expand Up @@ -87,7 +87,9 @@ export class HTML5History extends History {

export function getLocation (base: string): string {
let path = window.location.pathname
if (base && path.toLowerCase().indexOf(base.toLowerCase()) === 0) {
// base="/a" shouldn't turn path="/app" into "/a/pp" https://github.com/vuejs/vue-router/issues/3555
if (base && ((path.toLowerCase() === base.toLowerCase())
|| (path.toLowerCase().indexOf(cleanPath(base.toLowerCase() + "/")) === 0))) {
path = path.slice(base.length)
}
return (path || '/') + window.location.search + window.location.hash
Expand Down

0 comments on commit d976211

Please sign in to comment.