feat: update radio

pull/1845/head
tangjinzhou 2020-02-22 20:06:49 +08:00
parent f7ad7defe5
commit 601f9c159b
4 changed files with 11 additions and 11 deletions

View File

@ -1,5 +1,5 @@
module.exports = { module.exports = {
dev: { dev: {
componentName: 'progress', // dev components componentName: 'radio', // dev components
}, },
}; };

View File

@ -104,7 +104,7 @@ export default {
if (typeof option === 'string') { if (typeof option === 'string') {
return ( return (
<Radio <Radio
key={index} key={option}
prefixCls={prefixCls} prefixCls={prefixCls}
disabled={props.disabled} disabled={props.disabled}
value={option} value={option}
@ -116,7 +116,7 @@ export default {
} else { } else {
return ( return (
<Radio <Radio
key={index} key={`radio-group-value-options-${option.value}`}
prefixCls={prefixCls} prefixCls={prefixCls}
disabled={option.disabled || props.disabled} disabled={option.disabled || props.disabled}
value={option.value} value={option.value}

View File

@ -28,17 +28,17 @@ export default {
configProvider: { default: () => ConfigConsumerProps }, configProvider: { default: () => ConfigConsumerProps },
}, },
methods: { methods: {
handleChange(event) {
const targetChecked = event.target.checked;
this.$emit('input', targetChecked);
this.$emit('change', event);
},
focus() { focus() {
this.$refs.vcCheckbox.focus(); this.$refs.vcCheckbox.focus();
}, },
blur() { blur() {
this.$refs.vcCheckbox.blur(); this.$refs.vcCheckbox.blur();
}, },
handleChange(event) {
const targetChecked = event.target.checked;
this.$emit('input', targetChecked);
this.$emit('change', event);
},
onChange(e) { onChange(e) {
this.$emit('change', e); this.$emit('change', e);
if (this.radioGroupContext && this.radioGroupContext.onRadioChange) { if (this.radioGroupContext && this.radioGroupContext.onRadioChange) {

View File

@ -1,11 +1,11 @@
<cn> <cn>
#### 单选组合 - 配合 name 使用 #### 单选组合 - 配合 name 使用
可以为 RadioGroup 配置 `name` 参数,为组合内的 input 元素赋予相同的 `name` 属性,使浏览器把 RadioGroup 下的 Radio 真正看作是一组(例如可以通过方向键始终**在同一组内**更改选项)。 可以为 Radio.Group 配置 `name` 参数,为组合内的 input 元素赋予相同的 `name` 属性,使浏览器把 Radio.Group 下的 Radio 真正看作是一组(例如可以通过方向键始终**在同一组内**更改选项)。
</cn> </cn>
<us> <us>
#### RadioGroup with name #### Radio.Group with name
Passing the `name` property to all `input[type="radio"]` that are in the same RadioGroup. It is usually used to let the browser see your RadioGroup as a real "group" and keep the default behavior. For example, using left/right keyboard arrow to change your selection that in the same RadioGroup. Passing the `name` property to all `input[type="radio"]` that are in the same Radio.Group. It is usually used to let the browser see your Radio.Group as a real "group" and keep the default behavior. For example, using left/right keyboard arrow to change your selection that in the same Radio.Group.
</us> </us>
```tpl ```tpl