feat: UI i18n depends on router (#289)

This commit is contained in:
Dream Hunter
2024-06-01 12:12:13 +08:00
committed by GitHub
parent 7a368d7b23
commit b792c196c1
38 changed files with 106 additions and 102 deletions

View File

@@ -17,6 +17,16 @@ const i18n = createI18n({
messages: {}
}
})
router.beforeEach((to, from) => {
if (to.params.lang) {
i18n.global.locale.value = to.params.lang
} else {
i18n.global.locale.value = 'zh'
}
});
const head = createHead()
const app = createApp(App)
app.use(i18n)