From cf38250fa98e77a3f5d773e15dde7d9d6ca21ed4 Mon Sep 17 00:00:00 2001 From: DreamyTZK <82026204+kkfive@users.noreply.github.com> Date: Sun, 15 May 2022 14:18:10 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E4=BC=98=E5=8C=96twikoo=E8=AF=84?= =?UTF-8?q?=E8=AE=BA=EF=BC=8C=E6=97=A0=E8=AF=84=E8=AE=BA=E6=95=B0=E5=AE=B9?= =?UTF-8?q?=E5=99=A8=E6=97=B6=E4=B8=8D=E8=B0=83=E7=94=A8API=E8=8E=B7?= =?UTF-8?q?=E5=8F=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- layout/includes/third-party/comments/twikoo.pug | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/layout/includes/third-party/comments/twikoo.pug b/layout/includes/third-party/comments/twikoo.pug index 386ab3fb6..7ae8f6325 100644 --- a/layout/includes/third-party/comments/twikoo.pug +++ b/layout/includes/third-party/comments/twikoo.pug @@ -15,13 +15,15 @@ script. } const getCount = () => { + const countELement = document.getElementById('twikoo-count') + if(!countELement) return twikoo.getCommentsCount({ envId: '!{envId}', region: '!{region}', urls: [window.location.pathname], includeReply: false }).then(function (res) { - document.getElementById('twikoo-count').innerText = res[0].count + countELement.innerText = res[0].count }).catch(function (err) { console.error(err); }); @@ -48,4 +50,4 @@ script. loadTwikoo() } } - })() \ No newline at end of file + })()