* Get child by path * 通过路径获取子对象
(path: string)
| 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 |