diff --git a/src/components/Comments/Giscus.astro b/src/components/Comments/Giscus.astro index 624aa31..8212d73 100644 --- a/src/components/Comments/Giscus.astro +++ b/src/components/Comments/Giscus.astro @@ -62,7 +62,11 @@ const { function changeGiscusTheme() { const iframe = document.querySelector("iframe.giscus-frame"); - if (!iframe) return; + if (!iframe || iframe.classList.contains("giscus-frame--loading")) { + // 脚本未加载场景 + loadGiscus(); + return; + }; const theme = document.documentElement.classList.contains("dark") ? host + "/css/giscus_dark.css" : host + "/css/giscus_light.css";