Browse Source

update radio

pull/76/head
afc163 9 years ago
parent
commit
ddc3f83d76
  1. 16
      components/form/demo/mix.md
  2. 6
      components/radio/group.jsx
  3. 3
      components/radio/index.jsx
  4. 4
      style/components/radio.less

16
components/form/demo/mix.md

@ -17,6 +17,7 @@ var Dropdown = antd.Dropdown;
var Slider = antd.Slider;
var Checkbox = antd.Checkbox;
var Radio = antd.Radio;
var RadioGroup = antd.RadioGroup;
var menu = <Menu>
<Menu.Item>
@ -101,15 +102,12 @@ React.render(
<div className="ant-form-item ant-form-item-compact">
<label for="" className="col-6" required>ant-radio:</label>
<div className="col-16">
<label className="ant-radio-inline">
<Radio name="radio" />选项一
</label>
<label className="ant-radio-inline">
<Radio name="radio" />选项二
</label>
<label className="ant-radio-inline">
<Radio name="radio" />选项三
</label>
<RadioGroup>
<Radio value="a" checked={true}>选项一</Radio>
<Radio value="b">选项二</Radio>
<Radio value="c">选项三</Radio>
<Radio value="d">选项四</Radio>
</RadioGroup>
</div>
</div>
<div className="ant-form-item ant-form-item-compact">

6
components/radio/group.jsx

@ -26,7 +26,7 @@ var AntRadioGroup = React.createClass({
if (radio.props) {
return <Radio {...radio.props}
onChange={self.onRadioChange}
checked = {self.state.selectedValue === radio.props.value}
checked={self.state.selectedValue === radio.props.value}
/>;
}
return radio;
@ -41,7 +41,9 @@ var AntRadioGroup = React.createClass({
this.setState({
selectedValue: ev.target.value
});
this.props.onChange(ev);
if (typeof this.props.onChange === 'function') {
this.props.onChange(ev);
}
}
});

3
components/radio/index.jsx

@ -8,10 +8,9 @@ var AntRadio = React.createClass({
};
},
render() {
return (
<label>
<Radio {...this.props} children={null}/>
<Radio {...this.props} children={null} />
{this.props.children}
</label>
);

4
style/components/radio.less

@ -4,8 +4,8 @@
@radioDuration: .3s;
.@{radioGroupPrefixCls} {
& label{
margin-right: 10px;
label {
margin-right: 16px;
}
}

Loading…
Cancel
Save