mirror of
https://github.com/ant-design/ant-design.git
synced 2024-12-26 01:42:30 +08:00
39 lines
794 B
Markdown
39 lines
794 B
Markdown
# RadioGroup组合
|
|
|
|
- order: 1
|
|
|
|
RadioGroup 组合。
|
|
|
|
---
|
|
|
|
````jsx
|
|
var Radio = antd.Radio;
|
|
var RadioGroup = antd.RadioGroup;
|
|
|
|
var App = React.createClass({
|
|
getInitialState: function () {
|
|
return {
|
|
value:"a"
|
|
};
|
|
},
|
|
onChange(ev) {
|
|
console.log('radio checked:' + ev.target.value);
|
|
this.setState({
|
|
value:ev.target.value
|
|
})
|
|
},
|
|
render() {
|
|
return<div>
|
|
<RadioGroup onChange={this.onChange} value={this.state.value}>
|
|
<Radio value="a">A</Radio>
|
|
<Radio value="b" >B</Radio>
|
|
<Radio value="c" >C</Radio>
|
|
<Radio value="d" disabled={true}>D</Radio>
|
|
</RadioGroup>
|
|
你选中的: {this.state.value}
|
|
</div>
|
|
}
|
|
});
|
|
React.render(<App />, document.getElementById('components-radio-demo-radiogroup'));
|
|
````
|