fix(render): Toc rendering error, fixed #106

This commit is contained in:
qingwei.li 2017-02-28 22:00:53 +08:00 committed by cinwell.li
parent 0aead898eb
commit 0d59ee939f
2 changed files with 3 additions and 2 deletions

View File

@ -106,8 +106,9 @@ export function sidebar (text, level) {
html = markdown(text)
html = html.match(/<ul[^>]*>([\s\S]+)<\/ul>/g)[0]
} else {
const tree = genTree(toc, level)
const tree = cacheTree[currentPath] || genTree(toc, level)
html = treeTpl(tree, '<ul>')
cacheTree[currentPath] = tree
}
return html

View File

@ -75,7 +75,7 @@ export function renderMixin (proto) {
this._renderTo('.sidebar-nav', sidebar(text, maxLevel))
const active = getAndActive('.sidebar-nav', true, true)
loadSidebar && subSidebar(active, subMaxLevel)
subSidebar(loadSidebar ? active : '', subMaxLevel)
// bind event
this.activeLink = active
scrollActiveSidebar()