diff --git a/src/ui/ComponentExtendHelper.ts b/src/ui/ComponentExtendHelper.ts index 8189908..06e4095 100644 --- a/src/ui/ComponentExtendHelper.ts +++ b/src/ui/ComponentExtendHelper.ts @@ -24,7 +24,7 @@ export class ComponentExtendHelper { private static registerComponent(ctor: any, pkg: string, name: string): void { // 自定义组件扩展 const onConstruct = function (this: any): void { - PropsHelper.serializeProps(this, pkg); + PropsHelper.serializeProps(this, pkg, name); this.onInit && this.onInit(); }; ctor.prototype.onConstruct = onConstruct; diff --git a/src/ui/PropsHelper.ts b/src/ui/PropsHelper.ts index b418403..74dd456 100644 --- a/src/ui/PropsHelper.ts +++ b/src/ui/PropsHelper.ts @@ -28,7 +28,7 @@ export class PropsHelper { } /** 序列化属性 @internal */ - public static serializeProps(component: GComponent, packageName: string): void { + public static serializeProps(component: GComponent, packageName: string, componentName?: string): void { if (!this._config) { return; } @@ -36,7 +36,7 @@ export class PropsHelper { if (!config) { return; } - const componentName = component.name; + componentName = componentName || component.name; const propsInfo = config[componentName]; if (!propsInfo) { return;