Skip to content

Commit 8dde871

Browse files
committed
fix: 修复radio的bug Meituan-Dianping#3
1. fix 文档错误 checkedValues 应该是 checkedValue 2. fix 当Radio.Item的trueValue为0时会不能识别
1 parent afc98b2 commit 8dde871

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

components/Radio/radio-item.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ class RadioItem extends Component {
4141
const {checked, trueValue, label} = this.props;
4242
// checked 模式下触发 emitOneChange
4343
if (checked) {
44-
const _label = trueValue || label;
44+
const _label = trueValue == null ? label : trueValue;
4545
this.context.emitOneChange && this.context.emitOneChange(_label, checked);
4646
}
4747
}
@@ -162,4 +162,4 @@ class RadioItem extends Component {
162162

163163

164164

165-
export default RadioItem;
165+
export default RadioItem;

docs/components/Radio.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ import Radio from 'beeshell/components/Radio';
3030

3131
import { Radio } from 'beeshell';
3232

33-
<Radio checkedValues={this.state.deliveryTime} onChange={() => {}}>
33+
<Radio checkedValue={this.state.deliveryTime} onChange={() => {}}>
3434
<Radio.Item key={'a'} label="百度" trueValue="1" />
3535
<Radio.Item key={'b'} label="阿里" trueValue="2" />
3636
<Radio.Item key={'c'} label="腾讯" trueValue="3" />
@@ -43,7 +43,7 @@ import { Radio } from 'beeshell';
4343

4444
| Name | Type | Required | Default | Description |
4545
| ---- | ---- | ---- | ---- | ---- |
46-
| checkedValues | Array | false | null | 默认选中的值,其中的值就是 Radio.Item 的 label 或者 trueValue(优先级高),再次被设置时会相应改变, 并联动全选状态的改变 |
46+
| checkedValue | Any | false | null | 默认选中的值,其中的值就是 Radio.Item 的 label 或者 trueValue(优先级高),再次被设置时会相应改变, 并联动全选状态的改变 |
4747
| showAllChecked | Boolean | false | false | 是否展示全选按钮 |
4848
| onChange | Function | false | null | 选项变化回调 |
4949
| iconPosition | String | false | 'left' | 选项扭 icon 位置 |

0 commit comments

Comments
 (0)