chore: 优化 top entry 的 get 子项逻辑

This commit is contained in:
lihao.ylh 2021-09-23 16:26:50 +08:00
parent 1eec3b3d4f
commit 8555b94630
3 changed files with 4 additions and 3 deletions

View File

@ -13,5 +13,5 @@ export interface SettingEntry extends SettingTarget {
// 父级 // 父级
readonly parent: SettingEntry; readonly parent: SettingEntry;
get(propName: string | number): SettingEntry; get(propName: string | number): SettingEntry | null;
} }

View File

@ -150,7 +150,8 @@ export class SettingTopEntry implements SettingEntry {
/** /**
* *
*/ */
get(propName: string | number): SettingPropEntry { get(propName: string | number): SettingPropEntry | null {
if (!propName) return null;
return this._settingFieldMap[propName] || (new SettingPropEntry(this, propName)); return this._settingFieldMap[propName] || (new SettingPropEntry(this, propName));
} }

View File

@ -42,7 +42,7 @@ export interface SettingTarget {
setValue(value: any): void; setValue(value: any): void;
// 取得子项 // 取得子项
get(propName: string | number): SettingTarget; get(propName: string | number): SettingTarget | null;
// 获取子项属性值 // 获取子项属性值
getPropValue(propName: string | number): any; getPropValue(propName: string | number): any;