Fix:修复最新评论切换无法获取

This commit is contained in:
羡羡 2023-06-30 15:30:44 +08:00
parent fc8f345a0d
commit 1f5ef43b17
1 changed files with 28 additions and 24 deletions

View File

@ -4,11 +4,9 @@
<div class="card-widget card-recent-post" th:fragment="comments">
<div class="item-headline"><i class="iconfont icon-comment-dots"></i><span>最新评论</span></div>
<div class="aside-list" id="newcomm">
</div>
</div>
<script th:src="@{/assets/libs/twikoo/twikoo.all.min.js}"></script>
<script th:if="${theme.config.comments.twikoo && #strings.equals(theme.config.comments.use, 'Twikoo') && not #strings.isEmpty(theme.config.comments.envId)}">
(()=>{
const pagesize = [[${theme.config.sidebar.newcommentnumber}]];
const defaultpagesize = 5;
const finalpagesize = pagesize <= 0 ? defaultpagesize : pagesize;
@ -35,10 +33,16 @@
</div>
</div>`
});
document.querySelector('#newcomm').innerHTML = commenthtml;
let necomm = document.querySelector('#newcomm')
necomm.innerHTML = commenthtml;
window.lazyLoadInstance && window.lazyLoadInstance.update()
window.pjax && window.pjax.refresh(necomm)
}).catch(function (err) {
// 发生错误
console.error(err);
});
})();
</script>
</div>
</div>
</html>