From 6d48ce1266a988dad81344f84edba71b6d56a83d Mon Sep 17 00:00:00 2001 From: "qingwei.li" Date: Fri, 2 Jun 2017 17:56:38 +0800 Subject: [PATCH] fix(hash): hash routing crashes when url has querystring --- src/core/router/history/hash.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/core/router/history/hash.js b/src/core/router/history/hash.js index 73b54ef3b..6a2dea9eb 100644 --- a/src/core/router/history/hash.js +++ b/src/core/router/history/hash.js @@ -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),