perf: 优化体积,highlight.js按需导入与i18n按需加载 (#696)

* perf: 优化打包体积,highlight.js按需导入与i18n按需加载

1. highlight.js: 从全量导入改为 core + 注册27种常用语言,减少约500~800KB
2. i18n: 只同步加载en语言包,其他8种语言改为异步加载,首屏减少约350~400KB
3. 使用vue-i18n的setLocaleMessage API动态注册语言包
4. 新增switchLocale函数统一处理语言切换
5. 同步更新相关测试文件的mock路径和API适配

* 修复类型断言
This commit is contained in:
Butter Rice Cake of Gemini
2026-05-14 12:39:36 +08:00
committed by GitHub
parent 1b4733e755
commit f6df0fecfa
8 changed files with 134 additions and 47 deletions
+4 -2
View File
@@ -1,7 +1,7 @@
import { createApp } from 'vue'
import { createPinia } from 'pinia'
import router from './router'
import { i18n } from './i18n'
import { i18n, setupI18n } from './i18n'
import App from './App.vue'
import './styles/global.scss'
@@ -36,4 +36,6 @@ const app = createApp(App)
app.use(createPinia())
app.use(i18n)
app.use(router)
app.mount('#app')
setupI18n().then(() => {
app.mount('#app')
})