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

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

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({ const app = createApp(App)
const router = createRouter({
history: createWebHistory(), history: createWebHistory(),
extendRoutes: routes => setupLayouts(routes), extendRoutes: routes => setupLayouts(routes),
}) })
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(ToastService)
app.mount('#app')
}
app.use(PrimeVue) main()
app.use(ToastService)
app.mount('#app')