* Fixed mapModel issue when input name is nested
This commit is contained in:
parent
07f2a51a30
commit
958bd98223
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -98,11 +98,12 @@ Formsy.Form = React.createClass({
|
|||
return this.props.mapping(this.model)
|
||||
} else {
|
||||
return Object.keys(this.model).reduce(function (mappedModel, key) {
|
||||
|
||||
|
||||
var keyArray = key.split('.');
|
||||
var base = mappedModel;
|
||||
while (keyArray.length) {
|
||||
var currentKey = keyArray.shift();
|
||||
mappedModel[currentKey] = keyArray.length ? mappedModel[currentKey] || {} : this.model[key];
|
||||
base = (base[currentKey] = keyArray.length ? base[currentKey] || {} : this.model[key]);
|
||||
}
|
||||
|
||||
return mappedModel;
|
||||
|
|
|
|||
Loading…
Reference in New Issue