From 547cab2ac0da103a7fff3fc7a0912ffa7bab9969 Mon Sep 17 00:00:00 2001 From: luyuan <1162963624@qq.com> Date: Sat, 31 Oct 2020 14:47:50 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=BA=86=E5=85=B3=E4=BA=8E?= =?UTF-8?q?=E4=B8=8E=E6=8F=92=E4=BB=B6=E7=9A=84=E8=AF=AD=E8=A8=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/App.vue | 10 ++++-- src/utils/i18n.ts | 1 + src/views/login/About.vue | 72 +++++++++++++++++++++++++++++++++------ src/views/login/Login.vue | 6 ++-- 4 files changed, 72 insertions(+), 17 deletions(-) diff --git a/src/App.vue b/src/App.vue index 9c88408..57c9e01 100644 --- a/src/App.vue +++ b/src/App.vue @@ -3,7 +3,7 @@ Home | About --> - + @@ -20,7 +20,7 @@ import zhCN from 'ant-design-vue/es/locale/zh_CN'; export default defineComponent({ setup(){ console.log(i18ninit) - provideI18n(i18ninit); + const len = provideI18n(i18ninit); if(getValue('token')){ store.commit("login", true) store.dispatch("setUserInfo"); @@ -29,8 +29,12 @@ export default defineComponent({ store.dispatch("getip"); router.push("/") } + const zh = zhCN + const en = enUS return{ - locale: zhCN + zh, + en, + len } } }) diff --git a/src/utils/i18n.ts b/src/utils/i18n.ts index 88b9011..c03d8b7 100644 --- a/src/utils/i18n.ts +++ b/src/utils/i18n.ts @@ -26,6 +26,7 @@ const i18nSymbol = Symbol(); export function provideI18n(i18nConfig: Config) { const i18n = createI18n(i18nConfig); provide(i18nSymbol, i18n); + return i18n; } export function useI18n() { diff --git a/src/views/login/About.vue b/src/views/login/About.vue index 9b14cc5..1c20c7b 100644 --- a/src/views/login/About.vue +++ b/src/views/login/About.vue @@ -7,21 +7,22 @@ Beelink
-
立即登录
-
立即注册
+
{{lan.$t('lijidenglu')}}
+
{{lan.$t('lijizhuce')}}
- -
+ +
-
{{userinfo.language}}
- +
{{userinfo.language}}
+