xCss / Valine

A fast, simple & powerful comment system.
https://valine.js.org
GNU General Public License v2.0
2.19k stars 253 forks source link

在vuepress中使用 跳转页面评论数据不更新 #130

Closed songStar0904 closed 5 years ago

songStar0904 commented 5 years ago

在跳转不同页面的时候,valine发的每次请求参数都一样导致评论数据不更新。 有人用

watch: {
     '$route' (to, from) {
        if(to.path !==  from.path){
          this.$router.go(0)
        }else{
           // nothing
       }
     }
   }, 

问题解决,但是每次跳转页面网页刷新导致体验很不友好。请问还有其他解决办法吗

alosktx commented 5 years ago

怎么弄,我的是每次网页一刷新评论就没有了

alosktx commented 5 years ago

在跳转不同页面的时候,valine发的每次请求参数都一样导致评论数据不更新。 有人用

watch: {
     '$route' (to, from) {
        if(to.path !==  from.path){
          this.$router.go(0)
        }else{
           // nothing
       }
     }
   }, 

问题解决,但是每次跳转页面网页刷新导致体验很不友好。请问还有其他解决办法吗

怎么弄啊

songStar0904 commented 5 years ago

在跳转不同页面的时候,valine发的每次请求参数都一样导致评论数据不更新。 有人用

watch: {
     '$route' (to, from) {
        if(to.path !==  from.path){
          this.$router.go(0)
        }else{
           // nothing
       }
     }
   }, 

问题解决,但是每次跳转页面网页刷新导致体验很不友好。请问还有其他解决办法吗

怎么弄啊

就是我上面那样做的。。。在开发模式下会刷新网页(有点不爽)。但是在线上模式感觉不到刷新。。。

ChangMM commented 5 years ago
valine = new Valine({
      appId: '****',
      appKey: *****',
      el: '#comment',
      placeholder: '评论在此',
      avatar: 'monsterid',
      path: window.location.pathname,
      recordIP: true,
      visitor: true
    })

router 变化的时候重新渲染下上面的对象就好了,同时记得 path 要传一个自己设定的值,不然也是不行的。

wb121017405 commented 4 years ago

https://github.com/dongyuanxin/vuepress-plugin-comment/issues/4#issuecomment-555381607

ajunxu commented 3 years ago

怎么弄,我的是每次网页一刷新评论就没有了

请问解决了吗,我也是出现这样的情况