Skip to content

Commit 43551f8

Browse files
committed
feat: Add title to sidebar links
1 parent 7ea391b commit 43551f8

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

Diff for: src/core/event/sidebar.js

+2
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,8 @@ export function getAndActive(router, el, isParent, autoTitle) {
8686
const href = a.getAttribute('href');
8787
const node = isParent ? a.parentNode : a;
8888

89+
a.title = a.innerText;
90+
8991
if (hash.indexOf(href) === 0 && !target) {
9092
target = a;
9193
dom.toggleClass(node, 'add', 'active');

Diff for: src/core/render/tpl.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ export function tree(toc, tpl = '<ul class="app-sub-sidebar">{inner}</ul>') {
9191

9292
let innerHTML = '';
9393
toc.forEach(node => {
94-
innerHTML += `<li><a class="section-link" href="${node.slug}">${node.title}</a></li>`;
94+
innerHTML += `<li><a class="section-link" href="${node.slug}" title="${node.title}">${node.title}</a></li>`;
9595
if (node.children) {
9696
innerHTML += tree(node.children, tpl);
9797
}

0 commit comments

Comments
 (0)