From 91d63379366f2e569dc96015c83353413bb76c1f Mon Sep 17 00:00:00 2001 From: "qingwei.li" Date: Sun, 15 Oct 2017 10:43:35 +0800 Subject: [PATCH] fix: broken links to same page heading, fix #278, fix #279 --- src/core/router/history/hash.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/core/router/history/hash.js b/src/core/router/history/hash.js index 014a11b15..eccc6faeb 100644 --- a/src/core/router/history/hash.js +++ b/src/core/router/history/hash.js @@ -81,7 +81,9 @@ export class HashHistory extends History { path = path.replace(/\.md(\?)|\.md$/, '$1') if (local) { - path = currentRoute.substr(0, currentRoute.indexOf('?')) + path + const idIndex = currentRoute.indexOf('?') + path = + (idIndex > 0 ? currentRoute.substr(0, idIndex) : currentRoute) + path } return cleanPath('#/' + path)