gitment
gitment copied to clipboard
vue下不能使用,会报错
build.js:34436 [mobx] Encountered an uncaught exception that was thrown by a reaction or observer component, in: 'Reaction[Autorun@2] TypeError: Cannot read property 'firstChild' of null
同样我也遇到了这个问题
应该是没有创建相应的空div
如果使用的是以下方法
gitment.render('comments')
那就在使用之前在dom中插入以下元素(拥有相应id的空div)
<div id="comments"></div>
这样不行?
<div ref="comments"></div>
//...
gitment.render(this.$refs.comments);
我直接在 mounted 里初始化是可以的