Closed pointhalo closed 2 years ago
复现条件:validate[xxx] 数组中传入多级 fieldPath(例如 activity.needValidate),且这个fieldPath,前缀与其他 field 相同 (例如与 activity.a、activity.b的前缀都相同)。此时会导致 getNestedField判断错误,误以为 activity.a 、activity.b 是 activity.needValidate 的子级
// All fields: a[0]、a[1]、b.type、b.name[2]、b.name[0]
// input => output:
// a => a[0]、a[1]
// b => b.type、b.name[3]、b.name[2]
_getNestedField(path: string): Map<string, FieldStaff> {
const allRegisterField = this.fields;
const allFieldPath = [...allRegisterField].map(item => item[0]);
let nestedFieldPath = new Map();
allFieldPath.forEach(item => {
let itemPath = toPath(item);
let targetPath = toPath(path);
if (itemPath[0] === targetPath[0]) {
const realField = allRegisterField.get(item);
nestedFieldPath.set(item, realField);
}
});
return nestedFieldPath;
}
Which Component 出现bug的组件
semi-ui version
Expected result 期望的结果是什么
Actual result 实际的结果是什么
Steps to reproduce 复现步骤
Reproducible code 复现代码
Additional information 补充说明
Title
of the first field is changed to lowercase :title
, is correct