You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

22 lines
514 B

import assign from 'object-assign';
const ValueMixin = {
setValue(field, e) {
let v = e;
const target = e && e.target;
if (target) {
if ((`${target.nodeName}`).toLowerCase() === 'input' &&
target.type === 'checkbox') {
v = target.checked;
} else {
v = e.target.value;
}
}
const newFormData = {};
newFormData[field] = v;
this.setState({
formData: assign({}, this.state.formData, newFormData),
});
},
};
export default ValueMixin;