瘦身 P1-4: 摘掉 frontend-vue 的 bg.jpg,背景只用 webp

原写法 image-set(url("/bg.webp") 1x, url("/bg.jpg") 1x) 两个描述符同为 1x、webp 在前:
支持 image-set 的浏览器永远选 webp,jpg 一个字节都不会被请求;不支持 image-set 的浏览器
整条 background 声明作废(连 jpg 也拿不到)⇒ jpg 既不是主力也不是兜底,纯占体积。
改成直接 url("/bg.webp")(两处:DesktopHomePage.vue、ImageVideoPage.vue)。

量化:产物 new_web_source 1796.4 → 1630.5 KB(−165.9 KB),jpg 合计 169.6 → 10.5 KB(只剩 logo.jpg),
      bg.webp 86.9 KB 仍在产物里、magic 校验为 RIFF/WEBP。
验证:npm run build(含 vue-tsc --noEmit)rc=0;npm test ⇒ 851 pass / 0 fail。
      ⚠ 没在真浏览器里点过这两页的视觉渲染,本轮只验到"资源在、CSS 引用在、构建与用例绿"。
This commit is contained in:
2026-10-15 13:44:22 +08:00
parent abfacb1081
commit 4536513eea
3 changed files with 2 additions and 2 deletions
Binary file not shown.

Before

Width:  |  Height:  |  Size: 166 KiB

@@ -230,7 +230,7 @@ body {
/* 背景只挂根容器,不再写全局 body 背景:页面各自的 body 规则会在 SPA 注入顺序上互相覆盖 */
min-height: 100vh;
background: linear-gradient(rgba(255, 255, 255, 0.5), rgba(255, 255, 255, 0.5)),
image-set(url("/bg.webp") 1x, url("/bg.jpg") 1x) center/cover no-repeat #eef3f7;
url("/bg.webp") center/cover no-repeat #eef3f7;
display: flex;
flex-direction: column;
align-items: center;
@@ -266,7 +266,7 @@ async function launchDesktop() {
font-family: "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", sans-serif;
background:
linear-gradient(rgba(255, 255, 255, 0.5), rgba(255, 255, 255, 0.5)),
image-set(url('/bg.webp') 1x, url('/bg.jpg') 1x) center/cover no-repeat,
url('/bg.webp') center/cover no-repeat,
#eef3f7;
}