修复首屏:增加预加载占位并提前恢复主题

This commit is contained in:
cieanyau committed 2026-11-07 05:47:34 +08:00
1 parent 83b7484558
commit 30cbfd3a9c
7 files changed
+395 -23

No files matched your search

+19
View File
@@ -1,4 +1,6 @@
/** 应用构建入口;所有运行时业务地址来自公开配置,不绑定历史服务器目录。 */
import { applyTheme } from "./app/utils/theme-appearance.js";
export default defineNuxtConfig({
compatibilityDate: "2026-10-25",
// 页面依赖浏览器存储、DOM 及远控能力,使用客户端 SPA,而非服务端渲染页面。
@@ -39,7 +41,24 @@ export default defineNuxtConfig({
head: {
htmlAttrs: { lang: "zh-CN" },
title: "破碎工坊云 - 会员中心",
script: [
{
key: "console-theme",
// 普通内联脚本在业务模块和首次绘制前恢复外观,不等待网络或组件挂载。
innerHTML: `(${applyTheme.toString()})();`,
tagPriority: "critical",
},
],
link: [
// 只预载全站共享的小资源;中文分片字体继续按实际字符加载,避免抢占首屏带宽。
{ rel: "preload", as: "image", href: "/images/brand/logo.png" },
{
rel: "preload",
as: "font",
type: "font/woff2",
crossorigin: "anonymous",
href: "/icons/primeicons.Cw7jw2u3.woff2",
},
// 字体和站点图标随 public/ 分发,离线测试和私有部署不依赖外部 CDN。
{ rel: "stylesheet", href: "/fonts/harmonyos-sans-sc/Regular.css" },
{ rel: "stylesheet", href: "/fonts/harmonyos-sans-sc/Semibold.css" },