From ca5e4da63f84b3556fedba5238e0182fcb25fad3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=8D=E5=81=9A=E7=A0=81=E5=86=9C?= <599854767@qq.com> Date: Fri, 6 May 2022 22:15:33 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=8A=A8=E6=80=81=E5=A4=9A?= =?UTF-8?q?=E8=AF=AD=E8=A8=80=E8=B5=84=E6=BA=90=E6=9F=A5=E8=AF=A2=E8=AE=BE?= =?UTF-8?q?=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/i18n/index.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/i18n/index.js b/src/i18n/index.js index fd08727..3732983 100644 --- a/src/i18n/index.js +++ b/src/i18n/index.js @@ -1,6 +1,6 @@ import { createI18n } from 'vue-i18n'; import store from '@/store/index'; - +import { listLangByLocale } from '@/api/system/commonLang' import zhCn from './lang/zh-cn'; import en from './lang/en'; import zhTw from './lang/zh-tw'; @@ -21,5 +21,14 @@ const i18n = createI18n({ 'en': { ...en, ...pageLoginEn } } }) +console.log('lang=' + store.getters.language) +listLangByLocale(store.getters.language).then(res => { + const { code, data } = res + if (code == 200) { + i18n.global.mergeLocaleMessage('zh-cn', data.cn) + i18n.global.mergeLocaleMessage('zh-tw', data.tw) + i18n.global.mergeLocaleMessage('en', data.en) + } +}) export default i18n; \ No newline at end of file