跳到主要内容
版本:v7

ion-radio-group

单选按钮组是一组 单选按钮 的容器。它允许用户从一组选项中最多选择一个单选按钮。当选中属于同一组的某个单选按钮时,之前在该组内选中的任何其他单选按钮都将被取消选中。有关单选按钮组的使用示例,请参阅 单选按钮 文档。

接口

RadioGroupChangeEventDetail

interface RadioGroupChangeEventDetail<T = any> {
value: T;
}

RadioGroupCustomEvent

虽然不是必需的,但可以使用此接口替代 CustomEvent 接口,以便在使用此组件触发的 Ionic 事件时获得更严格的类型检查。

interface RadioGroupCustomEvent<T = any> extends CustomEvent {
detail: RadioGroupChangeEventDetail<T>;
target: HTMLIonRadioGroupElement;
}

属性

allowEmptySelection

DescriptionIf true, the radios can be deselected.
Attributeallow-empty-selection
Typeboolean
Defaultfalse

compareWith

DescriptionThis property allows developers to specify a custom function or property name for comparing objects when determining the selected option in the ion-radio-group. When not specified, the default behavior will use strict equality (===) for comparison.
Attributecompare-with
Type((currentValue: any, compareValue: any) => boolean) | null | string | undefined
Defaultundefined

name

DescriptionThe name of the control, which is submitted with the form data.
Attributename
Typestring
Defaultthis.inputId

value

Descriptionthe value of the radio group.
Attributevalue
Typeany
Defaultundefined

事件

NameDescriptionBubbles
ionChangeEmitted when the value has changed.true

方法

No public methods available for this component.

CSS 影子部分

No CSS shadow parts available for this component.

CSS 自定义属性

No CSS custom properties available for this component.

插槽

No slots available for this component.