MCPcopy Create free account
hub / github.com/esengine/esengine / getChildByPath

Method getChildByPath

packages/fairygui/src/core/GComponent.ts:223–236  ·  view source on GitHub ↗

* Get child by path * 通过路径获取子对象

(path: string)

Source from the content-addressed store, hash-verified

221 * 通过路径获取子对象
222 */
223 public getChildByPath(path: string): GObject | null {
224 const arr = path.split('.');
225 let obj: GObject | null = this;
226
227 for (const part of arr) {
228 if (obj instanceof GComponent) {
229 obj = obj.getChild(part);
230 } else {
231 return null;
232 }
233 }
234
235 return obj;
236 }
237
238 /**
239 * Get child index

Callers 1

setupItemMethod · 0.80

Calls 1

getChildMethod · 0.45

Tested by

no test coverage detected