跳到主要内容
版本:v8

ion-radio-group

单选按钮组是一组单选按钮的容器。它允许用户从一组中最多选择一个单选按钮。选中属于某个单选按钮组的一个单选按钮会取消选中同一组中先前选中的任何单选按钮。有关单选按钮组的示例用法,请参阅 radio 文档。

接口​

RadioGroupChangeEventDetail​

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

RadioGroupCustomEvent​

虽然不是必需的,但此接口可以替代 CustomEvent 接口,为此组件发出的 Ionic 事件提供更强的类型支持。

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

属性​

allowEmptySelection​

说明If true, the radios can be deselected.
属性allow-empty-selection
类型boolean
默认值false

compareWith​

说明This 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.
属性compare-with
类型((currentValue: any, compareValue: any) => boolean) | null | string | undefined
默认值undefined

errorText​

说明The error text to display at the top of the radio group.
属性error-text
类型string | undefined
默认值undefined

helperText​

说明The helper text to display at the top of the radio group.
属性helper-text
类型string | undefined
默认值undefined

name​

说明The name of the control, which is submitted with the form data.
属性name
类型string
默认值this.inputId

value​

说明the value of the radio group.
属性value
类型any
默认值undefined

事件​

Name说明冒泡
ionChangeEmitted when the value has changed.

This event will not emit when programmatically setting the value property.
true

方法​

该组件没有可用的公共方法。

CSS Shadow Parts​

该组件没有可用的 CSS 阴影部分。

CSS 自定义属性​

该组件没有可用的 CSS 自定义属性。

插槽​

该组件没有可用的插槽。