Skip to content

Commit 68bc8c8

Browse files
committed
fix(hash): parameters should be placed before hash(vuejs#2876)
1 parent fe7d454 commit 68bc8c8

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

Diff for: src/history/hash.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ function getUrl (path) {
142142
const query = searchPos > -1 ? base.slice(searchPos) : ''
143143
base = query ? base.slice(0, searchPos) : base
144144

145-
return `${base}#${path + query}`
145+
return `${base}${query}#${path}`
146146
}
147147

148148
function pushHash (path) {

Diff for: test/e2e/specs/hash-mode.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -62,13 +62,13 @@ module.exports = {
6262
// https://github.com/vuejs/vue-router/issues/2125
6363
.url('http://localhost:8080/hash-mode/?key=foo')
6464
.waitForElementVisible('#app', 1000)
65-
.assert.urlEquals('http://localhost:8080/hash-mode/#/?key=foo')
65+
.assert.urlEquals('http://localhost:8080/hash-mode/?key=foo#/')
6666
.url('http://localhost:8080/hash-mode?key=foo')
6767
.waitForElementVisible('#app', 1000)
68-
.assert.urlEquals('http://localhost:8080/hash-mode/#/?key=foo')
68+
.assert.urlEquals('http://localhost:8080/hash-mode/?key=foo#/')
6969
.url('http://localhost:8080/hash-mode?key=foo#other')
7070
.waitForElementVisible('#app', 1000)
71-
.assert.urlEquals('http://localhost:8080/hash-mode/#/other?key=foo')
71+
.assert.urlEquals('http://localhost:8080/hash-mode/?key=foo#/other')
7272
.end()
7373
}
7474
}

0 commit comments

Comments
 (0)