From a0db002ca621f47f8df0f9a1bf0b776c54923eca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E7=90=A6?= Date: Sat, 1 Aug 2026 16:01:05 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B9=9D=E5=AE=AB=E6=A0=BC=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- vite-tailwindcss/index.html | 6 +- .../src/components/PhotoGallery.vue | 52 +++++++----- vite-tailwindcss/src/views/index/index.vue | 81 +++++++++++++++++-- 3 files changed, 107 insertions(+), 32 deletions(-) diff --git a/vite-tailwindcss/index.html b/vite-tailwindcss/index.html index e1795a5..13ddbb6 100644 --- a/vite-tailwindcss/index.html +++ b/vite-tailwindcss/index.html @@ -4,12 +4,12 @@ - + - + - + 李琦&李逸烁的婚礼请柬 diff --git a/vite-tailwindcss/src/components/PhotoGallery.vue b/vite-tailwindcss/src/components/PhotoGallery.vue index 3fc37dd..c5edfd8 100644 --- a/vite-tailwindcss/src/components/PhotoGallery.vue +++ b/vite-tailwindcss/src/components/PhotoGallery.vue @@ -38,18 +38,19 @@ - +
new Promise((resolve) => { } }) +/** 离屏预解码,完成后再抬 shownCount,避免先露白底框 */ +const preloadBatch = (urls) => Promise.race([ + Promise.allSettled( + urls.map((url) => { + if (!url) return Promise.resolve() + const img = new Image() + img.decoding = 'async' + img.src = url + return decodeImg(img) + }) + ), + new Promise((resolve) => setTimeout(resolve, BATCH_DECODE_TIMEOUT_MS)), +]) + const runBatchedReveal = async () => { const images = props.page.images || [] const total = images.length if (!total) return for (let start = 0; start < total; start += BATCH_SIZE) { - nineShownCount.value = Math.min(total, start + BATCH_SIZE) + const end = Math.min(total, start + BATCH_SIZE) + await preloadBatch(images.slice(start, end)) + await yieldToMain() + // decode 完再挂载:白卡纸/边框与图片一同走 reveal + nineShownCount.value = end await nextTick() await yieldToMain() - const root = nineGridRef.value - const end = nineShownCount.value - const imgs = root - ? [...root.querySelectorAll('img[data-nine-idx]')].filter((el) => { - const i = Number(el.getAttribute('data-nine-idx')) - return i >= start && i < end - }) - : [] - - await Promise.race([ - Promise.allSettled(imgs.map(decodeImg)), - new Promise((resolve) => setTimeout(resolve, BATCH_DECODE_TIMEOUT_MS)), - ]) - if (end < total) { await new Promise((resolve) => setTimeout(resolve, BATCH_GAP_MS)) await yieldToMain() @@ -259,13 +264,16 @@ function getRevealConfig(imgIdx) { backface-visibility: hidden; } .nine-grid-img:hover { transform: translateZ(0) scale(1.03); } -/* 透明占位:占满格子尺寸但不露灰底,避免 activate 时布局跳动 */ +.nine-grid-slot { + background: transparent; +} +/* 透明占位:占满格子尺寸,不露白底/边框 */ .nine-grid-placeholder { visibility: hidden; pointer-events: none; - background: transparent; - border: none; - box-shadow: none; + background: transparent !important; + border: none !important; + box-shadow: none !important; } .overlap-wrap { height: clamp(320px, 54vh, 460px); } diff --git a/vite-tailwindcss/src/views/index/index.vue b/vite-tailwindcss/src/views/index/index.vue index b1418f1..6b4b611 100644 --- a/vite-tailwindcss/src/views/index/index.vue +++ b/vite-tailwindcss/src/views/index/index.vue @@ -264,8 +264,12 @@
-
-
+
+
出席回执 敬 请 回 复 @@ -293,10 +297,18 @@ 感恩您的祝福 回执已妥投,期待与您共享喜悦 +
-
+
选择导航方式
@@ -306,6 +318,20 @@
+
+ +
+

请点击右上角 ···

+

选择「在浏览器打开」后再导航

+

轻触屏幕关闭

+
+
+