fix(render): Toc rendering error, fixed #106
This commit is contained in:
parent
0aead898eb
commit
0d59ee939f
2 changed files with 3 additions and 2 deletions
|
|
@ -106,8 +106,9 @@ export function sidebar (text, level) {
|
||||||
html = markdown(text)
|
html = markdown(text)
|
||||||
html = html.match(/<ul[^>]*>([\s\S]+)<\/ul>/g)[0]
|
html = html.match(/<ul[^>]*>([\s\S]+)<\/ul>/g)[0]
|
||||||
} else {
|
} else {
|
||||||
const tree = genTree(toc, level)
|
const tree = cacheTree[currentPath] || genTree(toc, level)
|
||||||
html = treeTpl(tree, '<ul>')
|
html = treeTpl(tree, '<ul>')
|
||||||
|
cacheTree[currentPath] = tree
|
||||||
}
|
}
|
||||||
|
|
||||||
return html
|
return html
|
||||||
|
|
|
||||||
|
|
@ -75,7 +75,7 @@ export function renderMixin (proto) {
|
||||||
|
|
||||||
this._renderTo('.sidebar-nav', sidebar(text, maxLevel))
|
this._renderTo('.sidebar-nav', sidebar(text, maxLevel))
|
||||||
const active = getAndActive('.sidebar-nav', true, true)
|
const active = getAndActive('.sidebar-nav', true, true)
|
||||||
loadSidebar && subSidebar(active, subMaxLevel)
|
subSidebar(loadSidebar ? active : '', subMaxLevel)
|
||||||
// bind event
|
// bind event
|
||||||
this.activeLink = active
|
this.activeLink = active
|
||||||
scrollActiveSidebar()
|
scrollActiveSidebar()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue