How react assigns values to traversed text boxes

1. If you use defaultValue, then the value returned by the background is no longer refreshed, and if you use value plus onChange, you don"t know how to do the individual value.

Mar.10,2021

< input value= {value} onChange= {(value, index) = > this.handleChange {value, index}} >


finally modify the data in the traversal array according to the data in the traversal array. For example,
< input type= "text" onChange= {e = > this.inputChang (e, item)} value= {item.cartAmount} / >
my default reality here is a value in the data returned by background, as long as the item is passed to item.cartAmount=e.target.value;. You can change it to the value entered in the text box!


input directly use v-model


you can refer to the first

of the React-ElementUi form component.
// element-ui ,  setState
// 
onChange(key, value) {
  this.state.form[key] = value;
  // this.forceUpdate();
}

I hope I can help you

Menu