Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

使用pjax时,报错:TypeError: Cannot read property 'Query' of undefined #58

Closed
yelog opened this issue Feb 27, 2018 · 2 comments
Closed
Labels

Comments

@yelog
Copy link

yelog commented Feb 27, 2018

问题描述

主题使用pjax,切换页面时不刷新整个页面。会出现下面的问题:
第一次加载页面,评论框可以正常使用,但是切换其他页面后(没有刷新整个页面),评论框下就显示TypeError: Cannot read property 'Query' of undefined ,需要刷新整个页面才能使用。

报错位置:new _root.v.Query('Comment');

这个 _root 中没有 v 这个属性。
刷新整个页面时,第一次执行到这句话是有 v 这个属性。
但是异步加载第二个页面后,第二次执行到这句话是没有 v 这个属性的。

报错效果

第一次访问加载成功,并且可以评论。
image

切换到其他文章就会出现问题。
image

博客系统:hexo
主题:hexo-theme-3-hexo
valine版本:v1.1.9-beta4

配置信息:

<script src="//cdn1.lncld.net/static/js/3.0.4/av-min.js"></script>
<script src='//unpkg.com/valine/dist/Valine.min.js'></script>
<div id="comments"></div>
<script>
    var notify = '<%= theme.valine.notify %>' == true ? true : false;
    var verify = '<%= theme.valine.verify %>' == true ? true : false;
    new Valine({
        el: '#comments',
        notify: notify,
        verify: verify,
        app_id: "<%= theme.valine.appid %>",
        app_key: "<%= theme.valine.appkey %>",
        placeholder: "<%= theme.valine.placeholder %>",
        avatar:"<%= theme.valine.avatar %>",
        path: '<%=url%>'
    });
</script>
@xCss
Copy link
Owner

xCss commented Mar 1, 2018

收到反馈,正在寻找解决办法~ #66

@stale
Copy link

stale bot commented May 28, 2018

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants