<td>
<input type="text"
name="num"
placeholder="数量"
defaultValue={$.readProp(om, 'num')}
onChange={foo.bind(null, i)}/>
</td>
<td>
<input type="text"
name="price"
placeholder="单价"
defaultValue={$.readProp(om, 'price')}
onChange={foo.bind(null, i)}/>
</td>
<td>
<input type="text"
name="totalPrice"
placeholder="总价"
defaultValue={$.readProp(om, 'totalPrice')}
onChange={foo.bind(null, i)}/>
</td>
看也知道你的代码并非React领域了...jQuery的钱符号($)都出现了。
所以乾脆用refs,让存取DOM更直接,范例1:
不过这样失去了使用React的大部份意义,所以应该要用React的state(状态)来作值的运算才是,范例2:
快快的写了一下,有试过应该是可以用的。