feat(core): Node中的instance初始为null,用于判断是否与组件产生关联

This commit is contained in:
roymondchen 2025-07-17 17:19:03 +08:00
parent 34bc223f02
commit 291de2005d

View File

@ -49,7 +49,7 @@ class Node extends EventEmitter {
[key: string]: any; [key: string]: any;
}; };
public events: EventConfig[] = []; public events: EventConfig[] = [];
public instance?: any = {}; public instance?: any = null;
public page?: Page; public page?: Page;
public parent?: Node; public parent?: Node;
public app: TMagicApp; public app: TMagicApp;
@ -78,7 +78,8 @@ class Node extends EventEmitter {
if ( if (
this.instance && this.instance &&
!Object.isFrozen(this.instance) && !Object.isFrozen(this.instance) &&
Object.getOwnPropertyDescriptor(this.instance, 'config')?.writable !== false Object.getOwnPropertyDescriptor(this.instance, 'config')?.writable !== false &&
!this.instance.__isVue
) { ) {
this.instance.config = data; this.instance.config = data;
} }