Skip to content

Commit 5c9aea8

Browse files
committed
feat: radio support number option
1 parent 71e1100 commit 5c9aea8

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

components/radio/Group.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ const radioGroupProps = {
2727
value: PropTypes.any,
2828
size: PropTypes.oneOf(RadioGroupSizeTypes).def('default'),
2929
options: {
30-
type: Array as PropType<Array<String | RadioGroupChildOption>>,
30+
type: Array as PropType<Array<string | RadioGroupChildOption | number>>,
3131
},
3232
disabled: PropTypes.looseBool,
3333
name: PropTypes.string,
@@ -95,7 +95,7 @@ export default defineComponent({
9595
const optionsPrefixCls =
9696
optionType === 'button' ? `${prefixCls.value}-button` : prefixCls.value;
9797
children = options.map(option => {
98-
if (typeof option === 'string') {
98+
if (typeof option === 'string' || typeof option === 'number') {
9999
return (
100100
<Radio
101101
key={option}

components/radio/index.en-US.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ Radio group can wrap a group of `Radio`。
3232
| buttonStyle | style type of radio button | `outline` \| `solid` | `outline` | |
3333
| disabled | Disable all radio buttons | boolean | false | |
3434
| name | The `name` property of all `input[type="radio"]` children | string | - | |
35-
| options | set children optional | string\[] \| Array&lt;{ label: string value: string disabled?: boolean }> | - | |
35+
| options | set children optional | string\[] \| number\[] \| Array&lt;{ label: string value: string disabled?: boolean }> | - | |
3636
| optionType | Set Radio optionType | `default` \| `button` | `default` | 3.0.0 |
3737
| size | size for radio button style | `large` \| `default` \| `small` | `default` | |
3838
| value(v-model) | Used for setting the currently selected value. | any | - | |

components/radio/index.zh-CN.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ cover: https://gw.alipayobjects.com/zos/alicdn/8cYb5seNB/Radio.svg
3333
| buttonStyle | RadioButton 的风格样式,目前有描边和填色两种风格 | `outline` \| `solid` | `outline` | |
3434
| disabled | 禁选所有子单选器 | boolean | false | |
3535
| name | RadioGroup 下所有 `input[type="radio"]``name` 属性 | string | - | |
36-
| options | 以配置形式设置子元素 | string\[] \| Array&lt;{ label: string value: string disabled?: boolean }> | - | |
36+
| options | 以配置形式设置子元素 | string\[] \| number[] \| Array&lt;{ label: string value: string disabled?: boolean }> | - | |
3737
| optionType | 用于设置 Radio `options` 类型 | `default` \| `button` | `default` | 3.0.0 |
3838
| size | 大小,只对按钮样式生效 | `large` \| `default` \| `small` | `default` | |
3939
| value(v-model) | 用于设置当前选中的值 | any | - | |

components/radio/style/index.less

+1-1
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ span.@{radio-prefix-cls} + * {
174174
display: inline-block;
175175
height: @btn-height-base;
176176
margin: 0;
177-
padding: 0 @padding-md - 1px;
177+
padding: 0 @radio-button-padding-horizontal;
178178
color: @radio-button-color;
179179
font-size: @font-size-base;
180180
line-height: @btn-height-base - 2px;

0 commit comments

Comments
 (0)