fix: EN切换失效、删除贡献者描述、版本按演进线分组(2D->3D)
- fix(i18n): composition 模式下响应式 locale 在 i18n.global 上(非 i18n.locale), loadLocaleAsync 与 useI18nLazy 改用 i18n.global.locale; useI18nLazy.current 改为派生自全局 locale 的 computed(单一数据源); 各组件 useI18n() 加 useScope:'global' 确保读到同一 composer。 headless 验证:默认中文(不下载EN chunk)->点EN加载en.[hash].js并切英文->切回中文 全通过 - content: 删除 MobileGame 概览中「主要贡献者 Zikai Wang... Hongxiang He...」句子 - timeline: 版本数据改为多演进线并行(zikai-ui/main/doby/roll-a-ball), 每线带 2D/3D 形态标记,3D 线前显示「形态转变:2D -> 3D 滚球」转折标记
This commit is contained in:
@@ -1,17 +1,19 @@
|
||||
import { ref } from 'vue'
|
||||
import { loadLocaleAsync } from '../i18n/index.js'
|
||||
import { ref, computed } from 'vue'
|
||||
import i18n, { loadLocaleAsync } from '../i18n/index.js'
|
||||
|
||||
const current = ref('zh-CN')
|
||||
const switching = ref(false)
|
||||
|
||||
// 语言懒加载切换逻辑
|
||||
// current 派生自全局 i18n composer 的 locale(composition 模式下在 i18n.global),
|
||||
// 与各组件内 useI18n({ useScope: 'global' }) 读到的是同一个 ref。
|
||||
export function useI18nLazy() {
|
||||
const current = computed(() => i18n.global.locale.value)
|
||||
|
||||
async function switchLocale(locale) {
|
||||
if (switching.value || current.value === locale) return
|
||||
switching.value = true
|
||||
try {
|
||||
await loadLocaleAsync(locale)
|
||||
current.value = locale
|
||||
} finally {
|
||||
switching.value = false
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user