fix(post-helper): fixed an error where commentsCountDom is empty

This commit is contained in:
XPoet 2022-10-20 17:07:41 +08:00
parent 69ffc208b8
commit 09b7f9633b
1 changed files with 2 additions and 0 deletions

View File

@ -92,7 +92,9 @@ function initToggleShowToc() {
// watch comments count // watch comments count
watchPostCommentsCount() { watchPostCommentsCount() {
const commentsCountDom = this.postToolsDom.querySelector('.post-comments-count') const commentsCountDom = this.postToolsDom.querySelector('.post-comments-count')
if (!commentsCountDom) return
const config = { attributes: true, childList: true } const config = { attributes: true, childList: true }
const callback = function (mutationsList) { const callback = function (mutationsList) {
mutationsList.forEach((item) => { mutationsList.forEach((item) => {
if (item.type === 'childList') { if (item.type === 'childList') {