mirror of
https://github.com/docsifyjs/docsify.git
synced 2025-12-08 19:55:52 +00:00
feat: Add title to sidebar links (#1286)
This commit is contained in:
parent
117405b2d7
commit
667496b85d
@ -86,6 +86,8 @@ export function getAndActive(router, el, isParent, autoTitle) {
|
||||
const href = a.getAttribute('href');
|
||||
const node = isParent ? a.parentNode : a;
|
||||
|
||||
a.title = a.innerText;
|
||||
|
||||
if (hash.indexOf(href) === 0 && !target) {
|
||||
target = a;
|
||||
dom.toggleClass(node, 'add', 'active');
|
||||
|
||||
@ -91,7 +91,7 @@ export function tree(toc, tpl = '<ul class="app-sub-sidebar">{inner}</ul>') {
|
||||
|
||||
let innerHTML = '';
|
||||
toc.forEach(node => {
|
||||
innerHTML += `<li><a class="section-link" href="${node.slug}">${node.title}</a></li>`;
|
||||
innerHTML += `<li><a class="section-link" href="${node.slug}" title="${node.title}">${node.title}</a></li>`;
|
||||
if (node.children) {
|
||||
innerHTML += tree(node.children, tpl);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user