mirror of
https://github.com/zhigang1992/docsify.git
synced 2026-04-29 01:45:53 +08:00
fix: re-render gitalk when router changed
This commit is contained in:
@@ -7,10 +7,16 @@ function install(hook) {
|
|||||||
const main = dom.getNode('#main')
|
const main = dom.getNode('#main')
|
||||||
div.style = `width: ${main.clientWidth}px; margin: 0 auto 20px;`
|
div.style = `width: ${main.clientWidth}px; margin: 0 auto 20px;`
|
||||||
dom.appendTo(dom.find('.content'), div)
|
dom.appendTo(dom.find('.content'), div)
|
||||||
const script = dom.create('script')
|
})
|
||||||
const content = `gitalk.render('gitalk-container')`
|
|
||||||
script.textContent = content
|
hook.doneEach(_ => {
|
||||||
dom.appendTo(dom.body, script)
|
const el = document.getElementById('gitalk-container')
|
||||||
|
while (el.hasChildNodes()) {
|
||||||
|
el.removeChild(el.firstChild)
|
||||||
|
}
|
||||||
|
|
||||||
|
// eslint-disable-next-line
|
||||||
|
gitalk.render('gitalk-container')
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user