fix: 修复自定义组件属性序列化失败的问题

This commit is contained in:
gongxh 2025-06-30 15:17:25 +08:00
parent 4108223407
commit 58abdfae52
2 changed files with 3 additions and 3 deletions

View File

@ -24,7 +24,7 @@ export class ComponentExtendHelper {
private static registerComponent(ctor: any, pkg: string, name: string): void { private static registerComponent(ctor: any, pkg: string, name: string): void {
// 自定义组件扩展 // 自定义组件扩展
const onConstruct = function (this: any): void { const onConstruct = function (this: any): void {
PropsHelper.serializeProps(this, pkg); PropsHelper.serializeProps(this, pkg, name);
this.onInit && this.onInit(); this.onInit && this.onInit();
}; };
ctor.prototype.onConstruct = onConstruct; ctor.prototype.onConstruct = onConstruct;

View File

@ -28,7 +28,7 @@ export class PropsHelper {
} }
/** 序列化属性 @internal */ /** 序列化属性 @internal */
public static serializeProps(component: GComponent, packageName: string): void { public static serializeProps(component: GComponent, packageName: string, componentName?: string): void {
if (!this._config) { if (!this._config) {
return; return;
} }
@ -36,7 +36,7 @@ export class PropsHelper {
if (!config) { if (!config) {
return; return;
} }
const componentName = component.name; componentName = componentName || component.name;
const propsInfo = config[componentName]; const propsInfo = config[componentName];
if (!propsInfo) { if (!propsInfo) {
return; return;