<Row ref={this.valuationModel} className="custom-option"> <Col span={18} offset={1}> <Item {...ItemArea} label='计价模式' > { getFieldDecorator('valuationModel',{ getValueFromEvent: this.radioChange })( <RadioGroup onChange={this.radioChange}> <Radio value='nums' key='1'>按数量计价</Radio> <Radio value='car' key='2'>按每车计价</Radio> <Radio value='mileage' key='3'>按里程数计价</Radio> <Radio value='startMileage' key='4'>按起步里程数计价</Radio> <Radio value='duringMileage' key='5'>按里程数区间计价</Radio> </RadioGroup> ) } </Item> </Col> </Row>
radioChange = (e)=>{ console.log(1111111) console.log(e.target.value) let t_valua = e.target.value this.setState({ valuation: e.target.value, }) return t_valua };
RadioGroup中的value会和getFieldDecorator中的value冲突,getValueFromEvent重新绑定就可以直接使用RadioGroup中的操作了;记得在radioChange 方法中returen赋值前的value,否则radio不会高亮