diff --git a/src/radio/src/RadioGroup.tsx b/src/radio/src/RadioGroup.tsx index 8c155ac7e55..3b343c99773 100644 --- a/src/radio/src/RadioGroup.tsx +++ b/src/radio/src/RadioGroup.tsx @@ -25,7 +25,7 @@ import { useRtl } from '../../_mixins/use-rtl' function mapSlot ( defaultSlot: VNode[], - value: string | number | null, + value: string | number | boolean | null, clsPrefix: string ): { children: VNodeChild[] @@ -100,9 +100,13 @@ function mapSlot ( export const radioGroupProps = { ...(useTheme.props as ThemeProps), name: String, - value: [String, Number] as PropType, + value: [String, Number, Boolean] as PropType< + string | number | boolean | null + >, defaultValue: { - type: [String, Number] as PropType, + type: [String, Number, Boolean] as PropType< + string | number | boolean | null + >, default: null }, size: String as PropType<'small' | 'medium' | 'large'>, @@ -145,7 +149,7 @@ export default defineComponent({ controlledValueRef, uncontrolledValueRef ) - function doUpdateValue (value: string | number): void { + function doUpdateValue (value: string | number | boolean): void { const { onUpdateValue, 'onUpdate:value': _onUpdateValue } = props if (onUpdateValue) { call(onUpdateValue as OnUpdateValueImpl, value) diff --git a/src/radio/src/interface.ts b/src/radio/src/interface.ts index 23715021ff6..b37f8ebc070 100644 --- a/src/radio/src/interface.ts +++ b/src/radio/src/interface.ts @@ -1,3 +1,3 @@ export type OnUpdateValue = (value: string & number) => void -export type OnUpdateValueImpl = (value: string | number) => void +export type OnUpdateValueImpl = (value: string | number | boolean) => void diff --git a/src/radio/src/use-radio.ts b/src/radio/src/use-radio.ts index d69cdb34a58..5c3badc1ca9 100644 --- a/src/radio/src/use-radio.ts +++ b/src/radio/src/use-radio.ts @@ -16,7 +16,7 @@ import { OnUpdateValue, OnUpdateValueImpl } from './interface' const radioProps = { name: String, value: { - type: [String, Number] as PropType, + type: [String, Number, Boolean] as PropType, default: 'on' }, checked: { @@ -53,7 +53,7 @@ const radioProps = { export interface RadioGroupInjection { mergedClsPrefixRef: Ref nameRef: Ref - valueRef: Ref + valueRef: Ref mergedSizeRef: Ref<'small' | 'medium' | 'large'> disabledRef: Ref doUpdateValue: OnUpdateValue