Browse Source

update radio label

pull/76/head
jljsj 9 years ago
parent
commit
7ef00b6a51
  1. 4
      components/radio/demo/basic.md
  2. 4
      components/radio/demo/disable.md
  3. 14
      components/radio/group.jsx
  4. 8
      components/radio/index.jsx

4
components/radio/demo/basic.md

@ -9,7 +9,5 @@
````jsx
var Radio = antd.Radio;
React.render(<label>
<Radio />Radio
</label>, document.getElementById('components-radio-demo-basic'));
React.render(<Radio >Radio</Radio>, document.getElementById('components-radio-demo-basic'));
````

4
components/radio/demo/disable.md

@ -26,9 +26,9 @@ var App = React.createClass({
},
render() {
return <div>
<Radio defaultChecked={false} disabled={this.state.disabled} />不可用
<Radio defaultChecked={false} disabled={this.state.disabled}>不可用</Radio>
<br />
<Radio defaultChecked={true} disabled={this.state.disabled} />不可用
<Radio defaultChecked={true} disabled={this.state.disabled}>不可用</Radio>
<div style={{marginTop: 20}}>
<button className="ant-btn ant-btn-primary" onClick={this.toggleDisabled}>
Toggle disabled

14
components/radio/group.jsx

@ -1,5 +1,5 @@
var React = require('react');
var Radio = require('rc-radio');
var Radio = require('./index');
var AntRadioGroup = React.createClass({
getDefaultProps: function () {
@ -24,14 +24,10 @@ var AntRadioGroup = React.createClass({
var props = self.props;
var children = props.children.map(function (radio) {
if (radio.props) {
return <label>
<Radio {...radio.props}
onChange={self.onRadioChange}
checked = {self.state.selectedValue === radio.props.value}
children={null}
/>
{radio.props.children}
</label>;
return <Radio {...radio.props}
onChange={self.onRadioChange}
checked = {self.state.selectedValue === radio.props.value}
/>;
}
return radio;
});

8
components/radio/index.jsx

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

Loading…
Cancel
Save