From f94b00a7229f2892ac88323e4972ad2561469bd1 Mon Sep 17 00:00:00 2001 From: wanchun <445436867@qq.com> Date: Tue, 18 Jan 2022 15:59:15 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20plugin-locale=E5=85=BC=E5=AE=B9compositi?= =?UTF-8?q?on=E5=9C=BA=E6=99=AF=E5=8F=98=E6=9B=B4locale?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/fes-plugin-locale/src/runtime/core.tpl | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/packages/fes-plugin-locale/src/runtime/core.tpl b/packages/fes-plugin-locale/src/runtime/core.tpl index eb7b10f6..006587e6 100644 --- a/packages/fes-plugin-locale/src/runtime/core.tpl +++ b/packages/fes-plugin-locale/src/runtime/core.tpl @@ -5,7 +5,7 @@ // locales目录下以语言简称为子文件下存放配置信息 // 其他插件可以运行时修改配置 // 所有插件使用一个语言和配置 -import { isRef } from 'vue'; +import { isRef, unref } from 'vue'; import { createI18n, useI18n } from '{{{ VUE_I18N_PATH }}}'; import { plugin, ApplyPluginsType } from "@@/core/coreExports"; import SelectLang from "./views/SelectLang"; @@ -52,7 +52,7 @@ const i18n = createI18n({ messages, }); -window.localStorage.setItem("fes_locale", i18n.global.locale); +window.localStorage.setItem("fes_locale", unref(i18n.global.locale)); const setLocale = ({ locale }) => { if (isRef(i18n.global.locale)) { i18n.global.locale.value = locale; @@ -73,9 +73,7 @@ const addLocale = ({ locale, messages }) => { const getAllLocales = () => { return Object.keys( - isRef(i18n.global.messages) - ? i18n.global.messages.value - : i18n.global.messages + unref(i18n.global.messages) ).sort(); };