perf: 图片渐进加载,缩短首屏等待
- 流内单图改用缩略图(原图仅在灯箱按需加载),体积大幅减小 - BubbleImage 加 decoding=async + 加载完淡入(ark-img-fade),图片逐张出现 - 视频海报/文件预览/推荐卡/热门榜补 decoding=async、lazy 原图无缩略图时自动回退,无回归。 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -68,9 +68,13 @@ export function BubbleImage({
|
||||
src={current}
|
||||
alt=""
|
||||
loading={loading}
|
||||
className={className}
|
||||
decoding="async"
|
||||
className={`ark-img-fade ${className ?? ""}`}
|
||||
onLoad={(e) => {
|
||||
const img = e.currentTarget;
|
||||
// Fade each image in as soon as it loads, so they appear progressively
|
||||
// instead of the page seeming to wait for everything.
|
||||
img.classList.add("is-loaded");
|
||||
if (img.naturalWidth && img.naturalHeight)
|
||||
onNaturalSize?.(img.naturalWidth, img.naturalHeight);
|
||||
}}
|
||||
|
||||
Reference in New Issue
Block a user