Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/reactjs/23.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 论文';s count.js脚本没有';t使用react.js网站在index.html中正常运行_Javascript_Reactjs_Disqus - Fatal编程技术网

Javascript 论文';s count.js脚本没有';t使用react.js网站在index.html中正常运行

Javascript 论文';s count.js脚本没有';t使用react.js网站在index.html中正常运行,javascript,reactjs,disqus,Javascript,Reactjs,Disqus,我花了很长时间让评论计数脚本在我的react页面上运行。首先,他们建议将脚本放在我的index.html文件中,标记的底部。我这样做了,但没有看到任何结果 好吧,在与Discus的支持人员反复讨论之后,我终于找到了答案;我很接近。解决办法是: componentDidMount(){ 获取计数({reset:true}); }, componentDidUpdate(){ 获取计数({reset:true}); },看起来reactjs可能正在对您预期的上下文做一些事情。您可以调整displ

我花了很长时间让评论计数脚本在我的react页面上运行。首先,他们建议将脚本放在我的index.html文件中,
标记的底部。我这样做了,但没有看到任何结果


好吧,在与Discus的支持人员反复讨论之后,我终于找到了答案;我很接近。解决办法是:

componentDidMount(){
获取计数({reset:true});
},
componentDidUpdate(){
获取计数({reset:true});

},
看起来reactjs可能正在对您预期的上下文做一些事情。您可以调整
displayCount
以便将
j
作为附加参数传递吗?不,这是一个由DISKS加载/创建的脚本,位于mtg-hunter.discus.com/count.js。虽然不是最佳解决方案,但看起来您可以更新代码。加载
count.js
后,将
discrewidgets.displayCount
分配给更符合您口味的函数。甚至可以创建一个
count.js
的本地副本,并对其进行修改和链接。至少,这可能有助于调试。