Skip to content

Commit b48ca18

Browse files
committed
update: enhance the scroll.
1 parent 91272ca commit b48ca18

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/core/router/history/hash.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,14 @@ export class HashHistory extends History {
4949
const el = e.target.tagName === 'A' ? e.target : e.target.parentNode;
5050

5151
if (el && el.tagName === 'A' && !/_blank/.test(el.target)) {
52-
navigating = true;
52+
// When click the same naigator in sidebar, it won't trigger the hashchange event, even though the content already scroll down and active other anchor.
53+
// In this scenario, we do the navigating thing via the click event.
54+
if (el.hash && el.hash === window.location.hash) {
55+
const source = 'navigate';
56+
cb({ event: e, source });
57+
} else {
58+
navigating = true;
59+
}
5360
}
5461
});
5562

0 commit comments

Comments
 (0)