Browse Source

Merge branch 'master' of github.com:ant-design/ant-design

pull/76/head
jljsj 9 years ago
parent
commit
8a89010663
  1. 16
      components/form/demo/mix.md
  2. 15
      components/radio/demo/radiogroup.md
  3. 9
      components/radio/group.jsx
  4. 3
      components/radio/index.jsx
  5. 2
      package.json
  6. 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">

15
components/radio/demo/radiogroup.md

@ -8,9 +8,9 @@ RadioGroup 组合。
````jsx
var Radio = antd.Radio;
var RadioGroup=antd.RadioGroup;
var RadioGroup = antd.RadioGroup;
var Group = React.createClass({
var App = React.createClass({
getInitialState: function () {
return {
selectedValue:"a"
@ -25,15 +25,14 @@ var Group = React.createClass({
render() {
return<div>
<RadioGroup onChange={this.onChange}>
<Radio value={"a"} checked={true}>A</Radio>
<Radio value={"b"} >B</Radio>
<Radio value={"c"} >C</Radio>
<Radio value={"d"} disabled={true}>D</Radio>
<Radio value="a" checked={true}>A</Radio>
<Radio value="b" >B</Radio>
<Radio value="c" >C</Radio>
<Radio value="d" disabled={true}>D</Radio>
</RadioGroup>
你选中的:&nbsp;&nbsp;{this.state.selectedValue}
</div>
}
});
React.render(<Group />, document.getElementById('components-radio-demo-radiogroup'));
React.render(<App />, document.getElementById('components-radio-demo-radiogroup'));
````

9
components/radio/group.jsx

@ -26,14 +26,14 @@ 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;
});
return (
<div className={props.prefixCls}>
{children}
{children}
</div>
);
},
@ -41,9 +41,10 @@ var AntRadioGroup = React.createClass({
this.setState({
selectedValue: ev.target.value
});
this.props.onChange(ev);
if (typeof this.props.onChange === 'function') {
this.props.onChange(ev);
}
}
});
module.exports = AntRadioGroup;

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>
);

2
package.json

@ -1,6 +1,6 @@
{
"name": "antd",
"version": "0.7.0-beta2",
"version": "0.7.0-beta1",
"title": "Ant Design",
"description": "一个设计&前端框架",
"homepage": "http://ant.design/",

4
style/components/radio.less

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

Loading…
Cancel
Save