mirror of
https://gitee.com/docsifyjs/docsify.git
synced 2024-12-02 12:10:04 +08:00
fix(compiler): force reset toc when rendering sidebar fixed #181
This commit is contained in:
parent
9b15d8d577
commit
ccf4c7c5cc
@ -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…
Reference in New Issue
Block a user