Skip to content

Commit 190ecbf

Browse files
committed
fix: solved navigation to same link error
1 parent 0c9221e commit 190ecbf

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/core/router/history/hash.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,15 @@ export class HashHistory extends History {
4646
let navigating = false;
4747

4848
on('click', e => {
49+
let hashArray = location.hash.split('?id=');
50+
if (
51+
e.target.tagName === 'A' &&
52+
hashArray.length === 2 &&
53+
e.target.text.toLowerCase().replaceAll(' ', '-') === hashArray[1]
54+
) {
55+
history.pushState(null, null, hashArray[0]);
56+
}
57+
4958
const el = e.target.tagName === 'A' ? e.target : e.target.parentNode;
5059

5160
if (el && el.tagName === 'A' && !/_blank/.test(el.target)) {

0 commit comments

Comments
 (0)