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

与twikoo新版的兼容问题 #678

Closed
3 tasks done
EmptyDreams opened this issue Sep 30, 2021 · 5 comments
Closed
3 tasks done

与twikoo新版的兼容问题 #678

EmptyDreams opened this issue Sep 30, 2021 · 5 comments
Labels
bug Something isn't working

Comments

@EmptyDreams
Copy link
Contributor

I want to create a Bug report

Butterfly Information

Butterfly Version: 3.8.3

Platform: windows

Browser: edge

twikoo1.4.9有一定的兼容问题,详情见:twikoojs/twikoo#237

@imaegoo
Copy link

imaegoo commented Sep 30, 2021

const loadTwikoo = (bool = false) => {
  if (typeof twikoo === 'object') {
    // 这一行执行的时候,location.pathname 是不是还没有变成新页面的 pathname?导致加载的还是上一页的评论。
    init()
    bool && $countDom && setTimeout(getCount,0)
  } else {
    getScript('!{theme.CDN.twikoo}').then(()=> {
      init()
      bool && $countDom && setTimeout(getCount,0)
    })
  }
}

@EmptyDreams
Copy link
Contributor Author

EmptyDreams commented Sep 30, 2021

const loadTwikoo = (bool = false) => {
  if (typeof twikoo === 'object') {
    // 这一行执行的时候,location.pathname 是不是还没有变成新页面的 pathname?导致加载的还是上一页的评论。
    init()
    bool && $countDom && setTimeout(getCount,0)
  } else {
    getScript('!{theme.CDN.twikoo}').then(()=> {
      init()
      bool && $countDom && setTimeout(getCount,0)
    })
  }
}

打开所有页面都是没有评论,如果有的话刷新可以显示出来,不论上一个页面是什么都这样
另外我的博客还没有更新,如果需要一些简单的测试的话也可以直接在我的博客上进行

@jerryc127 jerryc127 added the bug Something isn't working label Oct 1, 2021
@jerryc127
Copy link
Owner

應該不關 twikoo1.4.9 的事

你可以暫時這樣解決

把 comments. lazyload 開了

修改 themes\butterfly\layout\includes\third-party\comments\twikoo.pug

const loadTwikoo = (bool = false) => {
  if (typeof twikoo === 'object') {
    setTimeout(() => {
      init()
      bool && $countDom && getCount()
    },0)
  } else {
    getScript('!{theme.CDN.twikoo}').then(()=> {
      init()
      bool && $countDom && getCount()
    })
  }
}

@jerryc127
Copy link
Owner

const loadTwikoo = (bool = false) => {
  if (typeof twikoo === 'object') {
    // 这一行执行的时候,location.pathname 是不是还没有变成新页面的 pathname?导致加载的还是上一页的评论。
    init()
    bool && $countDom && setTimeout(getCount,0)
  } else {
    getScript('!{theme.CDN.twikoo}').then(()=> {
      init()
      bool && $countDom && setTimeout(getCount,0)
    })
  }
}

恩 location.pathname 還是上一個頁面的

@jerryc127
Copy link
Owner

cb82bfb

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants