【发布时间】:2020-05-13 07:21:01
【问题描述】:
所以我有 2 个单选按钮,当他们进行更改时,我想从进行更改的单选按钮中获取值。
这是我迄今为止尝试过的:
handleValue = (event) => {
this.setState({
chargetype: event.target.value,
});
};
<RadioGroup onChange={this.handleValue} horizontal>
<RadioButton value="fixed">Fixed</RadioButton>
<RadioButton value="people" >People</RadioButton>
</RadioGroup>
但由于某种原因,它没有得到 RadioButton 的值。
有谁知道正确的做法吗?
【问题讨论】:
-
RadioGroup和RadioButton是什么?它们是从哪里进口的?
标签: reactjs radio-button onchange react-radio-buttons