2015-07-17 16:06:46 +08:00
|
|
|
# RadioGroup组合
|
|
|
|
|
|
|
|
- order: 1
|
|
|
|
|
|
|
|
RadioGroup 组合。
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
````jsx
|
|
|
|
var Radio = antd.Radio;
|
2015-07-17 16:43:20 +08:00
|
|
|
var RadioGroup = antd.RadioGroup;
|
2015-07-17 16:06:46 +08:00
|
|
|
|
2015-07-17 16:43:20 +08:00
|
|
|
var App = React.createClass({
|
2015-07-17 16:06:46 +08:00
|
|
|
getInitialState: function () {
|
|
|
|
return {
|
2015-07-20 22:36:49 +08:00
|
|
|
value:"a"
|
2015-07-17 16:06:46 +08:00
|
|
|
};
|
|
|
|
},
|
|
|
|
onChange(ev) {
|
|
|
|
console.log('radio checked:' + ev.target.value);
|
|
|
|
this.setState({
|
2015-07-20 22:36:49 +08:00
|
|
|
value:ev.target.value
|
2015-07-17 16:06:46 +08:00
|
|
|
})
|
|
|
|
},
|
|
|
|
render() {
|
|
|
|
return<div>
|
2015-07-20 22:36:49 +08:00
|
|
|
<RadioGroup onChange={this.onChange} value={this.state.value}>
|
|
|
|
<Radio value="a">A</Radio>
|
2015-07-17 16:43:20 +08:00
|
|
|
<Radio value="b" >B</Radio>
|
|
|
|
<Radio value="c" >C</Radio>
|
|
|
|
<Radio value="d" disabled={true}>D</Radio>
|
2015-07-17 16:06:46 +08:00
|
|
|
</RadioGroup>
|
2015-07-20 22:36:49 +08:00
|
|
|
你选中的: {this.state.value}
|
2015-07-17 16:06:46 +08:00
|
|
|
</div>
|
|
|
|
}
|
|
|
|
});
|
2015-07-17 16:43:20 +08:00
|
|
|
React.render(<App />, document.getElementById('components-radio-demo-radiogroup'));
|
2015-07-17 16:06:46 +08:00
|
|
|
````
|