From ee3ce22b74cb420dec99368a3259abe5a4bea757 Mon Sep 17 00:00:00 2001 From: Lhcfl Date: Thu, 4 Apr 2024 15:20:15 +0800 Subject: [PATCH] fix type error of i18n.ts --- packages/client/src/components/global/i18n.ts | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/packages/client/src/components/global/i18n.ts b/packages/client/src/components/global/i18n.ts index 33db86c718..2427088e6e 100644 --- a/packages/client/src/components/global/i18n.ts +++ b/packages/client/src/components/global/i18n.ts @@ -38,13 +38,14 @@ export default defineComponent({ return h( this.tag, - parsed.map((x) => - typeof x === "string" - ? this.textTag - ? h(this.textTag, x) - : x - : this.$slots[x.arg](), - ), + parsed.map((x) => { + if (typeof x === "string") { + return this.textTag ? h(this.textTag, x) : x; + } else { + const t = this.$slots[x.arg]; + return t ? t() : `I18n[${x.arg}]`; + } + }), ); }, });