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'})` }" /> -