Open lixuguang opened 6 years ago
function extendRenderer(instance, renderer) { instance[renderer] = (container) => { const targetContainer = getTargetContainer(container) const render = instance.theme[renderer] || instance.defaultTheme[renderer]
autorun(() => { const e = render(instance.state, instance) if (targetContainer.firstChild) { targetContainer.replaceChild(e, targetContainer.firstChild) } else { targetContainer.appendChild(e) } }) return targetContainer
} }
mobx.js:1335 [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 at gitment.js:16 at reactionRunner (mobx.js:123) at trackDerivedFunction (mobx.js:1000) at Reaction.track (mobx.js:1312) at Reaction.onInvalidate (mobx.js:120) at Reaction.runReaction (mobx.js:1288) at runReactionsHelper (mobx.js:1404) at reactionScheduler (mobx.js:1386) at runReactions (mobx.js:1390) at Reaction.schedule (mobx.js:1276) Reaction.reportExceptionInDerivation @ mobx.js:1335 Reaction.track @ mobx.js:1319 (anonymous) @ mobx.js:120 Reaction.runReaction @ mobx.js:1288 runReactionsHelper @ mobx.js:1404 reactionScheduler @ mobx.js:1386 runReactions @ mobx.js:1390 Reaction.schedule @ mobx.js:1276 autorun @ mobx.js:125 instance.(anonymous function) @ gitment.js:14 (anonymous) @ (index):1549
我也遇到这个问题,解决了吗
没有,最近没再看
你需要在你的页面 创建一个div(评论控件的位置) id 为初始化的 gitment.render('comments') 比如
<div id='comments'></div>
https://advance-esthetic.us/rf-facial-machines
function extendRenderer(instance, renderer) { instance[renderer] = (container) => { const targetContainer = getTargetContainer(container) const render = instance.theme[renderer] || instance.defaultTheme[renderer]
} }
mobx.js:1335 [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 at gitment.js:16 at reactionRunner (mobx.js:123) at trackDerivedFunction (mobx.js:1000) at Reaction.track (mobx.js:1312) at Reaction.onInvalidate (mobx.js:120) at Reaction.runReaction (mobx.js:1288) at runReactionsHelper (mobx.js:1404) at reactionScheduler (mobx.js:1386) at runReactions (mobx.js:1390) at Reaction.schedule (mobx.js:1276) Reaction.reportExceptionInDerivation @ mobx.js:1335 Reaction.track @ mobx.js:1319 (anonymous) @ mobx.js:120 Reaction.runReaction @ mobx.js:1288 runReactionsHelper @ mobx.js:1404 reactionScheduler @ mobx.js:1386 runReactions @ mobx.js:1390 Reaction.schedule @ mobx.js:1276 autorun @ mobx.js:125 instance.(anonymous function) @ gitment.js:14 (anonymous) @ (index):1549