Skip to content

Commit

Permalink
fix: re-render gitalk when router changed
Browse files Browse the repository at this point in the history
  • Loading branch information
spiritree committed Feb 25, 2019
1 parent bc4d06b commit 11ea1f8
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/plugins/gitalk.js
Original file line number Diff line number Diff line change
Expand Up @@ -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')
})
}

Expand Down

0 comments on commit 11ea1f8

Please sign in to comment.