You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

39 lines
808 B

9 years ago
# RadioGroup组合
- order: 1
RadioGroup 组合。
---
````jsx
var Radio = antd.Radio;
9 years ago
var RadioGroup = antd.RadioGroup;
9 years ago
9 years ago
var App = React.createClass({
9 years ago
getInitialState: function () {
return {
selectedValue:"a"
};
},
onChange(ev) {
console.log('radio checked:' + ev.target.value);
this.setState({
selectedValue:ev.target.value
})
},
render() {
return<div>
<RadioGroup onChange={this.onChange}>
9 years ago
<Radio value="a" checked={true}>A</Radio>
<Radio value="b" >B</Radio>
<Radio value="c" >C</Radio>
<Radio value="d" disabled={true}>D</Radio>
9 years ago
</RadioGroup>
你选中的:&nbsp;&nbsp;{this.state.selectedValue}
</div>
}
});
9 years ago
React.render(<App />, document.getElementById('components-radio-demo-radiogroup'));
9 years ago
````