From b1bf76eb43eb54a05cf9cdf5744f17faafc224a6 Mon Sep 17 00:00:00 2001 From: raofuzi <2641346316@qq.com> Date: Sat, 20 Apr 2024 15:48:16 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BF=AE=E6=94=B9=E5=8A=A0=E8=BD=BD?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/home/content/Content.vue | 37 +++++++++++------------------- 1 file changed, 13 insertions(+), 24 deletions(-) diff --git a/src/views/home/content/Content.vue b/src/views/home/content/Content.vue index aca7e5f..4e424d9 100644 --- a/src/views/home/content/Content.vue +++ b/src/views/home/content/Content.vue @@ -117,19 +117,19 @@ const layout = debounce(() => { }) loading.value = false // 暂时注释,请忽略 - // _imagesload = imagesloaded('.grid-item') + _imagesload = imagesloaded('.grid-item') - // _imagesload.on('done', (instance) => { - // (_masonry as any).layout() - // if (!el.value) - // return - // loading.value = false - // }) + _imagesload.on('done', (instance) => { + (_masonry as any).layout() + if (!el.value) + return + loading.value = false + }) - // _imagesload.on('fail', (instance) => { - // message.error('图片错误') - // loading.value = false - // }) + _imagesload.on('fail', (instance) => { + message.error('图片错误') + loading.value = false + }) }, 300) useInfiniteScroll( @@ -144,7 +144,7 @@ onUpdated(() => { nextTick(() => { setTimeout(() => { layout() - }, 2000) + }, 50) }) }) @@ -739,19 +739,8 @@ defineExpose({ :preview-src="item.imgUrl" :src="item.thumburl" :fallback-src="bgLoadingImg" - style="display: none" + :style="{ backgroundImage: `url(${loading ? bgLoadingImg : 'none'})` }" /> -