fix(hash): hash routing crashes when url has querystring

This commit is contained in:
qingwei.li 2017-06-02 17:56:38 +08:00
commit 6d48ce1266
No known key found for this signature in database
GPG key ID: B6DDC2F7AE80B2F4

View file

@ -58,17 +58,17 @@ export class HashHistory extends History {
parse (path = location.href) {
let query = ''
const hashIndex = path.indexOf('#')
if (hashIndex) {
path = path.slice(hashIndex + 1)
}
const queryIndex = path.indexOf('?')
if (queryIndex >= 0) {
query = path.slice(queryIndex + 1)
path = path.slice(0, queryIndex)
}
const hashIndex = path.indexOf('#')
if (hashIndex) {
path = path.slice(hashIndex + 1)
}
return {
path,
file: this.getFile(path),