mirror of
https://github.com/ant-design/ant-design.git
synced 2025-01-18 14:13:37 +08:00
update radio demos
This commit is contained in:
parent
34b00a4ad7
commit
00a81ea98e
@ -11,6 +11,7 @@ var Radio = antd.Radio;
|
||||
var RadioGroup = React.createClass({
|
||||
getInitialState() {
|
||||
return {
|
||||
value: ''
|
||||
};
|
||||
},
|
||||
handleChange(e) {
|
||||
@ -25,28 +26,28 @@ var RadioGroup = React.createClass({
|
||||
<Radio value="a"
|
||||
checked={this.state.value === 'a'}
|
||||
onChange={this.handleChange} />
|
||||
A
|
||||
选项A
|
||||
</label>
|
||||
<br/>
|
||||
<label>
|
||||
<Radio value="b"
|
||||
checked={this.state.value === 'b'}
|
||||
onChange={this.handleChange} />
|
||||
B
|
||||
选项B
|
||||
</label>
|
||||
<br/>
|
||||
<label>
|
||||
<Radio value="c"
|
||||
checked={this.state.value === 'c'}
|
||||
onChange={this.handleChange} />
|
||||
C
|
||||
选项C
|
||||
</label>
|
||||
<br/>
|
||||
<label>
|
||||
<Radio value="d"
|
||||
checked={this.state.value === 'd'}
|
||||
onChange={this.handleChange} />
|
||||
D
|
||||
选项D
|
||||
</label>
|
||||
</p>
|
||||
<p style={{"margin-top": 20}}>
|
||||
|
@ -16,26 +16,9 @@
|
||||
## API
|
||||
|
||||
|
||||
| 参数 | 说明 | 类型 | 可选值 |默认值 |
|
||||
|-----------|------------------------------------------|------------|-------|--------|
|
||||
| checked | 指定当前是否选中 | boolean | | false |
|
||||
| defaultChecked | 初始是否选中 | boolean | | false |
|
||||
| onChange | 变化时回调函数,组合时必须 | Function(e:Event) | | |
|
||||
| value | value参数,组合时根据此项判定checked | -- | | | |
|
||||
|
||||
####组合使用:
|
||||
以value值来决定自身的checked,
|
||||
|
||||
gruop里需一个做全局checked的参数
|
||||
`getInitialState() {
|
||||
return {
|
||||
r: 'a'
|
||||
}
|
||||
}`
|
||||
|
||||
在自身checked上判断`this.state.r === 'a'`;
|
||||
|
||||
回调接口里
|
||||
`this.setState({
|
||||
r: e.target.value
|
||||
})`
|
||||
| 参数 | 说明 | 类型 | 可选值 | 默认值 |
|
||||
|----------------|------------------------------------------|------------|---------|--------|
|
||||
| checked | 指定当前是否选中 | boolean | | false |
|
||||
| defaultChecked | 初始是否选中 | boolean | | false |
|
||||
| onChange | 变化时回调函数,组合时必须 | Function(e:Event) | | |
|
||||
| value | 组合时根据此项判定checked | -- | | | |
|
||||
|
Loading…
Reference in New Issue
Block a user