diff --git a/components/radio/demo/basic.md b/components/radio/demo/basic.md index 3a4ca29502..0b139ebef0 100644 --- a/components/radio/demo/basic.md +++ b/components/radio/demo/basic.md @@ -9,9 +9,7 @@ ````jsx var Radio = antd.Radio; -React.render( - -, document.getElementById('components-radio-demo-basic')); +React.render(, document.getElementById('components-radio-demo-basic')); ```` diff --git a/components/radio/demo/disable.md b/components/radio/demo/disable.md index ab4d443d6c..7a650b0a6c 100644 --- a/components/radio/demo/disable.md +++ b/components/radio/demo/disable.md @@ -8,10 +8,35 @@ Radio 不可用。 ````jsx var Radio = antd.Radio; -var container = document.getElementById('components-radio-demo-disable'); -React.render(
-    - -
, container); +function toggleDisabled() { + disabled = !disabled; +} + +var App = React.createClass({ + getInitialState() { + return { + disabled: false + }; + }, + toggleDisabled() { + this.setState({ + disabled: !this.state.disabled + }); + }, + render() { + return
+ 不可用 +
+ 不可用 +
+
+ +
; + } +}); + +React.render(, document.getElementById('components-radio-demo-disable')); ```` diff --git a/components/radio/demo/group.md b/components/radio/demo/group.md index faa5e36911..496954bd34 100644 --- a/components/radio/demo/group.md +++ b/components/radio/demo/group.md @@ -8,68 +8,48 @@ Radio 组合。 ````jsx var Radio = antd.Radio; -var container = document.getElementById('components-radio-demo-group'); -var RadioGroup=React.createClass({ +var RadioGroup = React.createClass({ getInitialState() { return { - disabled: false, - r: 'a' - } + }; }, handleChange(e) { this.setState({ - r: e.target.value - }) - }, - toggle() { - this.setState({ - disabled: !this.state.disabled + value: e.target.value }); }, render() { return
-
-

- -
- -
- -
- -

-
-
你选中的:{this.state.r}
-

- +

+ +
+ +
+ +
+ +

+

+ 你选中了:{this.state.value} 。

-
; } }); -React.render(, container); +React.render(, document.getElementById('components-radio-demo-group')); ```` diff --git a/components/radio/index.md b/components/radio/index.md index 1b60f33224..539ea4f1d8 100644 --- a/components/radio/index.md +++ b/components/radio/index.md @@ -1,19 +1,20 @@ -# radio +# Radio - category: Components - chinese: 单选框 --- -多选框。 +单选框。 ## 何时使用 -- `radio` 一般用于选中单个状态,需要和提交操作配合。 +- 用于在多个备选项中选中单个状态。 +- 和 Select 的区别是,Radio 所有选项默认可见,方便用户在比较中选择,因此选项不宜过多。 + ## API -### Checkbox | 参数 | 说明 | 类型 | 可选值 |默认值 | |-----------|------------------------------------------|------------|-------|--------|