fix(compiler): force reset toc when rendering sidebar fixed #181
This commit is contained in:
parent
9b15d8d577
commit
ccf4c7c5cc
2 changed files with 7 additions and 0 deletions
|
|
@ -135,6 +135,10 @@ export class Compiler {
|
|||
* Compile sub sidebar
|
||||
*/
|
||||
subSidebar (level) {
|
||||
if (!level) {
|
||||
this.toc = []
|
||||
return
|
||||
}
|
||||
const currentPath = this.router.getCurrentPath()
|
||||
const { cacheTree, toc } = this
|
||||
|
||||
|
|
|
|||
|
|
@ -85,6 +85,9 @@ export function renderMixin (proto) {
|
|||
const activeEl = getAndActive(this.router, '.sidebar-nav', true, true)
|
||||
if (loadSidebar && activeEl) {
|
||||
activeEl.parentNode.innerHTML += this.compiler.subSidebar(subMaxLevel)
|
||||
} else {
|
||||
// reset toc
|
||||
this.compiler.subSidebar()
|
||||
}
|
||||
// bind event
|
||||
this._bindEventOnRendered()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue