例如我在Prefab的脚本里,定义了:
cc.Class(
{
properties:
{
Text:
{
get(){ return this.node.getChildByName( '@label' ).getComponent( cc.Label ).string; },
set(value){ this.node.getChildByName( '@label' ).getComponent( cc.Label ).string = value; },
},
}
}
尝试在properties中取得子节点的Component,
但这样无法运行,编辑器会提示无法从 undefine 中执行 getComponent
