---
title: "Ext.form.field.Radio"
description: "xtype 为 radiofield 的 Ext JS 原生组件参考。"
---

> Documentation Index
> Fetch the complete documentation index at: https://ag.879818327.xyz/llms.txt
> Use this file to discover all available pages before exploring further.

# Ext.form.field.Radio

源码定义：`ext-all-debug.js:98985`。分类：表单与字段。

## 创建示例

```javascript
var component = Ext.create("Ext.form.field.Radio", {
  xtype: "radiofield",
  ariaRole: 'radio',
  focusCls: 'form-radio-focus',
  formId: null,
  inputType: 'radio',
  renderTo: Ext.getBody()
});
```

## 属性

| 属性 | 类型 | 默认值 | 说明 | 配置示例 |
| --- | --- | --- | --- | --- |
| `ariaRole` | `String` | `'radio'` | 组件在辅助技术中的 ARIA 角色。 | `ariaRole: 'radio'` |
| `focusCls` | `String` | `'form-radio-focus'` | 配置 `focusCls` 对应的 CSS 类名。 | `focusCls: 'form-radio-focus'` |
| `formId` | `Object/null` | `null` | 配置组件的 `formId` 选项。 | `formId: null` |
| `inputType` | `String` | `'radio'` | 配置组件的 `inputType` 选项。 | `inputType: 'radio'` |
| `isRadio` | `Boolean` | `true` | 控制是否启用 `isRadio` 行为。 | `isRadio: true` |

## 方法

| 方法 | 参数 | 说明 | 调用示例 |
| --- | --- | --- | --- |
| `getGroupValue` | `` | 读取并返回 `groupValue`。源码涉及 `getManager()`、`getFormId()`。 | `component.getGroupValue()` |
| `onBoxClick` | `e` | 处理 `boxClick` 回调。 执行时会更新组件值。源码涉及 `setValue()`。 | `component.onBoxClick(...)` |
| `onRemoved` | `` | 处理 `removed` 回调。 执行时会保留父类默认行为、更新 `formId` 状态。源码涉及 `callParent()`。 | `component.onRemoved()` |
| `getSubmitValue` | `` | 读取并返回 `submitValue`。 | `component.getSubmitValue()` |
| `getModelData` | `` | 调用并直接返回父类的值，不对结果作额外转换。 | `component.getModelData()` |
| `onChange` | `newVal, oldVal` | 处理 `change` 回调。 执行时会保留父类默认行为。源码涉及 `callParent()`、`getManager()`、`getFormId()`。 | `component.onChange(...)` |
| `getManager` | `` | 读取并返回 `manager`。 | `component.getManager()` |

## 事件

源码中未找到该组件自身注册的事件；可监听继承事件。

Source: https://ag.879818327.xyz/ext/form/form-field-radio/index.mdx
