fix(form-item): Fix form-item props undefined bug (#888)

Co-authored-by: bastarder <jie.qian@blockheaders.com>
This commit is contained in:
bastarder
2020-12-08 21:04:04 +08:00
committed by GitHub
parent fa632b875e
commit 3832028775

View File

@@ -53,9 +53,14 @@ export function getPropByPath(obj: any, path: string, strict: boolean): {
for (i; i < keyArr.length - 1; i++) {
if (!tempObj && !strict) break
const key = keyArr[i]
tempObj = tempObj?.[key]
if (!tempObj && strict) {
throw new Error('please transfer a valid prop path to form item!')
if (key in tempObj) {
tempObj = tempObj[key]
} else {
if (strict) {
throw new Error('please transfer a valid prop path to form item!')
}
break
}
}
return {