Skip to content

fix get navItem object bug by Navigation.get(target) method.#1410

Open
NameHitherto wants to merge 1 commit intofuturepress:masterfrom
NameHitherto:fix-navigation-get
Open

fix get navItem object bug by Navigation.get(target) method.#1410
NameHitherto wants to merge 1 commit intofuturepress:masterfrom
NameHitherto:fix-navigation-get

Conversation

@NameHitherto
Copy link

When I want to use the get(target: string) method in navigation.js to get the target navItem I encountered a bug, the method provides two means of querying based on the id or href attributes of the navItem, when I need to query based on the id I need to manually add the # character, while at this time the target is no longer equal to the id value of the target navItem. So I restore the target value after the determination is over:

if(target.indexOf("#") === 0) {

and before calling getByIndex:
return this.getByIndex(target, index, this.toc);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant