Form: rule key supports both dot-separated and nested (#10227)

pull/10229/head
杨奕 2018-03-19 11:10:06 +08:00 committed by GitHub
parent 4abeadb7c1
commit a294c628e9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 1 deletions

View File

@ -235,7 +235,8 @@
const selfRules = this.rules;
const requiredRule = this.required !== undefined ? { required: !!this.required } : [];
formRules = formRules ? getPropByPath(formRules, this.prop || '').o[this.prop || ''] : [];
const prop = getPropByPath(formRules, this.prop || '');
formRules = formRules ? (prop.o[this.prop || ''] || prop.v) : [];
return [].concat(selfRules || formRules || []).concat(requiredRule);
},