Skip to content

Commit 91d6337

Browse files
committed
fix: broken links to same page heading, fix #278, fix #279
1 parent 26cc466 commit 91d6337

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/core/router/history/hash.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,9 @@ export class HashHistory extends History {
8181
path = path.replace(/\.md(\?)|\.md$/, '$1')
8282

8383
if (local) {
84-
path = currentRoute.substr(0, currentRoute.indexOf('?')) + path
84+
const idIndex = currentRoute.indexOf('?')
85+
path =
86+
(idIndex > 0 ? currentRoute.substr(0, idIndex) : currentRoute) + path
8587
}
8688

8789
return cleanPath('#/' + path)

0 commit comments

Comments
 (0)