From a07b128dd36adbd2a61691fbb929a499675f480d Mon Sep 17 00:00:00 2001 From: "tangly1024.com" Date: Thu, 21 Nov 2024 15:51:27 +0800 Subject: [PATCH] =?UTF-8?q?=E6=87=92=E5=8A=A0=E8=BD=BD=E5=9B=BE=E7=89=87?= =?UTF-8?q?=E7=BB=84=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/LazyImage.js | 22 +++++++++++-------- .../magzine/components/PostItemCardSimple.js | 2 +- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/components/LazyImage.js b/components/LazyImage.js index a5437883..acfb89c1 100644 --- a/components/LazyImage.js +++ b/components/LazyImage.js @@ -41,6 +41,10 @@ export default function LazyImage({ if (typeof onLoad === 'function') { onLoad() // 触发传递的onLoad回调函数 } + // 移除占位符类名 + if (imageRef.current) { + imageRef.current.classList.remove('lazy-image-placeholder') + } } /** * 图片加载失败回调 @@ -53,6 +57,7 @@ export default function LazyImage({ } else { imageRef.current.src = defaultPlaceholderSrc } + imageRef.current.classList.remove('lazy-image-placeholder') } } @@ -141,15 +146,14 @@ export default function LazyImage({ diff --git a/themes/magzine/components/PostItemCardSimple.js b/themes/magzine/components/PostItemCardSimple.js index 1a8b47f8..924876e6 100644 --- a/themes/magzine/components/PostItemCardSimple.js +++ b/themes/magzine/components/PostItemCardSimple.js @@ -8,7 +8,7 @@ import CategoryItem from './CategoryItem' * @param {*} param0 * @returns */ -const PostItemCardSimple = ({ post, showSummary }) => { +const PostItemCardSimple = ({ post }) => { return (