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
| Description | If true, the radios can be deselected. |
| Attribute | allow-empty-selection |
| Type | boolean |
| Default | false |
compareWith
| Description | 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. |
| Attribute | compare-with |
| Type | ((currentValue: any, compareValue: any) => boolean) | null | string | undefined |
| Default | undefined |
name
| Description | The name of the control, which is submitted with the form data. |
| Attribute | name |
| Type | string |
| Default | this.inputId |
value
| Description | the value of the radio group. |
| Attribute | value |
| Type | any |
| Default | undefined |
事件
| Name | Description | Bubbles |
|---|---|---|
ionChange | Emitted 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.