feat: UI i18n depends on router (#290)

This commit is contained in:
Dream Hunter
2024-06-01 12:13:44 +08:00
committed by GitHub
parent b792c196c1
commit e91bbe273a
2 changed files with 2 additions and 1 deletions

View File

@@ -19,7 +19,7 @@ const i18n = createI18n({
})
router.beforeEach((to, from) => {
if (to.params.lang) {
if (to.params.lang && ['en', 'zh'].includes(to.params.lang)) {
i18n.global.locale.value = to.params.lang
} else {
i18n.global.locale.value = 'zh'