🐞 fix: 全局作用域中异步加载语言

This commit is contained in:
m1m1sha 2024-05-07 23:01:23 +08:00
parent 5605d239ce
commit c768e1d13b

View File

@ -26,6 +26,9 @@ if (import.meta.env.PROD) {
}) })
} }
async function main() {
await loadLanguageAsync(localStorage.getItem('lang') || 'en')
const app = createApp(App) const app = createApp(App)
const router = createRouter({ const router = createRouter({
@ -36,8 +39,9 @@ const router = createRouter({
app.use(router) app.use(router)
app.use(createPinia()) app.use(createPinia())
app.use(i18n, { useScope: 'global' }) app.use(i18n, { useScope: 'global' })
loadLanguageAsync(localStorage.getItem('lang') || 'en')
app.use(PrimeVue) app.use(PrimeVue)
app.use(ToastService) app.use(ToastService)
app.mount('#app') app.mount('#app')
}
main()