File tree 1 file changed +3
-15
lines changed
1 file changed +3
-15
lines changed Original file line number Diff line number Diff line change @@ -107,27 +107,15 @@ function ensureSlash (): boolean {
107
107
}
108
108
109
109
export function getHash ( ) : string {
110
- // We can't use window.location.hash here because it's not
111
- // consistent across browsers - Firefox will pre-decode it!
110
+ // We need to get the raw hash to keep consistent behavior with routes
111
+ // `fullPath` using encoded path. The params are decoded later in the
112
+ // matcher.
112
113
let href = window . location . href
113
114
const index = href . indexOf ( '#' )
114
115
// empty path
115
116
if ( index < 0 ) return ''
116
117
117
118
href = href . slice ( index + 1 )
118
- // decode the hash but not the search or hash
119
- // as search(query) is already decoded
120
- // https://github.com/vuejs/vue-router/issues/2708
121
- const searchIndex = href . indexOf ( '?' )
122
- if ( searchIndex < 0 ) {
123
- const hashIndex = href . indexOf ( '#' )
124
- if ( hashIndex > - 1 ) {
125
- href = decodeURI ( href . slice ( 0 , hashIndex ) ) + href . slice ( hashIndex )
126
- } else href = decodeURI ( href )
127
- } else {
128
- href = decodeURI ( href . slice ( 0 , searchIndex ) ) + href . slice ( searchIndex )
129
- }
130
-
131
119
return href
132
120
}
133
121
You can’t perform that action at this time.
0 commit comments