From 710f3ba74f3e0ff53ff66bb1447907d6fcfd78f5 Mon Sep 17 00:00:00 2001 From: YJSON Date: Thu, 16 Jul 2020 10:24:28 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=F0=9F=90=9B=20=E9=80=BB=E8=BE=91?= =?UTF-8?q?=E7=AE=80=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../editor-preset-vision/src/bundle/prototype.ts | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/packages/editor-preset-vision/src/bundle/prototype.ts b/packages/editor-preset-vision/src/bundle/prototype.ts index e4e01f908..57b72046e 100644 --- a/packages/editor-preset-vision/src/bundle/prototype.ts +++ b/packages/editor-preset-vision/src/bundle/prototype.ts @@ -213,7 +213,7 @@ class Prototype { static addGlobalExtraActions = addGlobalExtraActions; static removeGlobalPropsConfigure = removeGlobalPropsConfigure; static overridePropsConfigure = overridePropsConfigure; - static create(config: OldPrototypeConfig | ComponentMetadata | ComponentMeta, lookup: boolean = false) { + static create(config: OldPrototypeConfig | ComponentMetadata | ComponentMeta, lookup = false) { return new Prototype(config, lookup); } @@ -221,7 +221,7 @@ class Prototype { readonly meta: ComponentMeta; readonly options: OldPrototypeConfig | ComponentMetadata; - constructor(input: OldPrototypeConfig | ComponentMetadata | ComponentMeta, lookup: boolean = false) { + constructor(input: OldPrototypeConfig | ComponentMetadata | ComponentMeta, lookup = false) { if (lookup) { this.meta = designer.getComponentMeta(input.componentName); this.options = this.meta.getMetadata(); @@ -260,15 +260,9 @@ class Prototype { getTitle(currentLocale?: string) { if (isI18nData(this.meta.title)) { - if (currentLocale && this.meta.title[currentLocale]) { - return this.meta.title[currentLocale]; - } - const locale = globalLocale.getLocale(); - if (this.meta.title && this.meta.title.type === 'i18n') { - return this.meta.title[locale] || this.meta.title; - } + const locale = currentLocale || globalLocale.getLocale(); + return this.meta.title[locale] || this.meta.title; } - return this.meta.title; }