From 5c9aea8a19139d54169968492bf0c968a1af3abf Mon Sep 17 00:00:00 2001 From: tangjinzhou <415800467@qq.com> Date: Thu, 17 Mar 2022 14:42:03 +0800 Subject: [PATCH] feat: radio support number option --- components/radio/Group.tsx | 4 ++-- components/radio/index.en-US.md | 2 +- components/radio/index.zh-CN.md | 2 +- components/radio/style/index.less | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/components/radio/Group.tsx b/components/radio/Group.tsx index 968c98713..e0aeac03c 100644 --- a/components/radio/Group.tsx +++ b/components/radio/Group.tsx @@ -27,7 +27,7 @@ const radioGroupProps = { value: PropTypes.any, size: PropTypes.oneOf(RadioGroupSizeTypes).def('default'), options: { - type: Array as PropType>, + type: Array as PropType>, }, disabled: PropTypes.looseBool, name: PropTypes.string, @@ -95,7 +95,7 @@ export default defineComponent({ const optionsPrefixCls = optionType === 'button' ? `${prefixCls.value}-button` : prefixCls.value; children = options.map(option => { - if (typeof option === 'string') { + if (typeof option === 'string' || typeof option === 'number') { return ( | - | | +| options | set children optional | string\[] \| number\[] \| Array<{ label: string value: string disabled?: boolean }> | - | | | optionType | Set Radio optionType | `default` \| `button` | `default` | 3.0.0 | | size | size for radio button style | `large` \| `default` \| `small` | `default` | | | value(v-model) | Used for setting the currently selected value. | any | - | | diff --git a/components/radio/index.zh-CN.md b/components/radio/index.zh-CN.md index 4687fdcce..45b4ee72f 100644 --- a/components/radio/index.zh-CN.md +++ b/components/radio/index.zh-CN.md @@ -33,7 +33,7 @@ cover: https://gw.alipayobjects.com/zos/alicdn/8cYb5seNB/Radio.svg | buttonStyle | RadioButton 的风格样式,目前有描边和填色两种风格 | `outline` \| `solid` | `outline` | | | disabled | 禁选所有子单选器 | boolean | false | | | name | RadioGroup 下所有 `input[type="radio"]` 的 `name` 属性 | string | - | | -| options | 以配置形式设置子元素 | string\[] \| Array<{ label: string value: string disabled?: boolean }> | - | | +| options | 以配置形式设置子元素 | string\[] \| number[] \| Array<{ label: string value: string disabled?: boolean }> | - | | | optionType | 用于设置 Radio `options` 类型 | `default` \| `button` | `default` | 3.0.0 | | size | 大小,只对按钮样式生效 | `large` \| `default` \| `small` | `default` | | | value(v-model) | 用于设置当前选中的值 | any | - | | diff --git a/components/radio/style/index.less b/components/radio/style/index.less index 44d4e499d..713dc25d0 100644 --- a/components/radio/style/index.less +++ b/components/radio/style/index.less @@ -174,7 +174,7 @@ span.@{radio-prefix-cls} + * { display: inline-block; height: @btn-height-base; margin: 0; - padding: 0 @padding-md - 1px; + padding: 0 @radio-button-padding-horizontal; color: @radio-button-color; font-size: @font-size-base; line-height: @btn-height-base - 2px;