点击关于,没有版本号,我用ai查了一下原因,updater.ts:87 里优先读 import.meta.env.VITE_APP_VERSION,但这个环境变量在 vite.config.web.mts 的 define 里从来没设置过,只有 Vite 自动注入的 npm_package_version 兜底,但这个注入在某些构建场景下也可能为空。最终 getCurrentVersion() 返回空字符串 "",而 AboutSection.tsx:123 用 ?? 判断,空字符串不是 nullish,所以显示 v 后面什么都没有。
修复内容:
vite.config.web.mts — 读取 package.json 的 version,在 define 中注入 VITE_APP_VERSION
AboutSection.tsx:123 — ?? 改为 ||,空字符串也能兜底显示 "unknown"
点击关于,没有版本号,我用ai查了一下原因,updater.ts:87 里优先读 import.meta.env.VITE_APP_VERSION,但这个环境变量在 vite.config.web.mts 的 define 里从来没设置过,只有 Vite 自动注入的 npm_package_version 兜底,但这个注入在某些构建场景下也可能为空。最终 getCurrentVersion() 返回空字符串 "",而 AboutSection.tsx:123 用 ?? 判断,空字符串不是 nullish,所以显示 v 后面什么都没有。
修复内容:
vite.config.web.mts — 读取 package.json 的 version,在 define 中注入 VITE_APP_VERSION
AboutSection.tsx:123 — ?? 改为 ||,空字符串也能兜底显示 "unknown"