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

This commit is contained in:
m1m1sha 2024-05-07 23:01:23 +08:00
parent 6089813da5
commit 5b14fc05d2

View File

@ -26,18 +26,22 @@ if (import.meta.env.PROD) {
})
}
const app = createApp(App)
async function main() {
await loadLanguageAsync(localStorage.getItem('lang') || 'en')
const router = createRouter({
history: createWebHistory(),
extendRoutes: routes => setupLayouts(routes),
})
const app = createApp(App)
app.use(router)
app.use(createPinia())
app.use(i18n, { useScope: 'global' })
loadLanguageAsync(localStorage.getItem('lang') || 'en')
const router = createRouter({
history: createWebHistory(),
extendRoutes: routes => setupLayouts(routes),
})
app.use(PrimeVue)
app.use(ToastService)
app.mount('#app')
app.use(router)
app.use(createPinia())
app.use(i18n, { useScope: 'global' })
app.use(PrimeVue)
app.use(ToastService)
app.mount('#app')
}
main()