Description
Radio 組件用於在一組選項中選擇單一選項,提供清晰的選擇狀態和良好的使用者體驗。
基本用法
基本用法
選中的值:無
群組用法
RadioGroup 群組
垂直佈局
選中的值:無
水平佈局
選中的值:無
帶禁用選項
選中的值:無
禁用整個群組
選中的值:option1
API
Radio 屬性
| 屬性名 | 說明 | 類型 | 默認值 |
|---|---|---|---|
| modelValue | 綁定值 | any | - |
| value | 選項值 | any | - |
| name | 原生 name 屬性 | string | - |
| disabled | 是否禁用 | boolean | false |
| required | 是否必填 | boolean | false |
| inputId | input 元素的 ID | string | - |
| inputClass | input 元素的類名 | string | - |
| inputStyle | input 元素的樣式 | StyleValue | - |
| label | 標籤文字 | string | - |
RadioGroup 屬性
| 屬性名 | 說明 | 類型 | 默認值 |
|---|---|---|---|
| modelValue | 綁定值 | any | - |
| options | 選項陣列 | (RadioOption | string)[] | [] |
| optionLabel | 選項標籤的屬性名 | string | 'label' |
| optionValue | 選項值的屬性名 | string | 'value' |
| optionDisabled | 選項禁用狀態的屬性名 | string | 'disabled' |
| disabled | 是否禁用整個群組 | boolean | false |
| name | 表單名稱 | string | - |
| orientation | 佈局方向 | 'horizontal' | 'vertical' | 'vertical' |
| label | 群組標籤 | string | - |
事件 Events
| 事件名 | 說明 | 回調參數 |
|---|---|---|
| update:modelValue | 更新模型值 | (value: any) => void |
| change | 值變更事件 | (event: Event) => void |
| focus | 獲得焦點事件 | (event: FocusEvent) => void |
| blur | 失去焦點事件 | (event: FocusEvent) => void |
插槽 Slots
| 插槽名 | 說明 |
|---|---|
| default | 預設插槽 |