Merge pull request #784 from spiritree/hotfix/gitalk

fix: re-render gitalk when router changed
master
Anton Wilhelm 5 years ago committed by GitHub
commit d5910bd1f9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 14
      src/plugins/gitalk.js

@ -7,10 +7,16 @@ function install(hook) {
const main = dom.getNode('#main')
div.style = `width: ${main.clientWidth}px; margin: 0 auto 20px;`
dom.appendTo(dom.find('.content'), div)
const script = dom.create('script')
const content = `gitalk.render('gitalk-container')`
script.textContent = content
dom.appendTo(dom.body, script)
})
hook.doneEach(_ => {
const el = document.getElementById('gitalk-container')
while (el.hasChildNodes()) {
el.removeChild(el.firstChild)
}
// eslint-disable-next-line
gitalk.render('gitalk-container')
})
}

Loading…
Cancel
Save