Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update: enhance the navigating. #1904

Draft
wants to merge 1 commit into
base: develop
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 8 additions & 1 deletion src/core/router/history/hash.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,14 @@ export class HashHistory extends History {
const el = e.target.tagName === 'A' ? e.target : e.target.parentNode;

if (el && el.tagName === 'A' && !/_blank/.test(el.target)) {
navigating = true;
// 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.
// In this scenario, we do the navigating thing via the click event.
if (el.hash && el.hash === window.location.hash) {
const source = 'navigate';
cb({ event: e, source });
} else {
navigating = true;
}
}
});

Expand Down