---
// src/components/Comment.astro
---

<div id="Comments" data-astro-transition-persist="twikoo-comments">
  <p style="text-align: center;">加载评论区中...</p>
</div>

<script is:inline>
  function initTwikoo() {
    if (window.tw) {
      if (document.getElementById("Comments")) {
        document.getElementById("Comments").innerHTML = "";
      }
      window.tw = null;
    }
    var tw = twikoo.init({
      el: "#Comments",
      envId: "https://twikoo.blog.yunqixh.cn",
      lang: "zh-CN",
    });
    window.tw = tw;
  }
  window.addEventListener("load", initTwikoo);
  document.addEventListener("astro:page-load", initTwikoo);
</script>
