CondorDictRadio
CondorDictRadio 是一个基于字典数据的单选框组件,用于显示动态字典选项并支持单选操作。该组件与字典存储(Pinia Store)集成,自动加载指定字典编码的数据并渲染为单选框组。
组件 Props
| 参数名 | 类型 | 默认值 | 说明 |
|---|---|---|---|
| code | string | - | 必需 字典编码,用于从字典存储中获取对应的字典数据列表 |
| value | string / number / null | null | 绑定的值,支持字符串、数字或null |
| type | 'number' / 'string' | 'string' | 值的类型,指定组件内部处理值的类型格式 |
组件事件
| 事件名 | 说明 | 参数 |
|---|---|---|
| update:value | 当单选框选择变化时触发 | 更新后的值(根据type格式返回对应类型) |
基本用法
1. 基本使用(字符串类型)
vue
<template>
<CondorDictRadio
code="gender"
v-model:value="selectedGender"
/>
</template>
<script setup lang="ts">
import { ref } from 'vue';
// 值为字符串类型
const selectedGender = ref('male');
</script>2. 基本使用(数字类型)
vue
<template>
<CondorDictRadio
code="status"
v-model:value="statusValue"
type="number"
/>
</template>
<script setup lang="ts">
import { ref } from 'vue';
// 值为数字类型
const statusValue = ref(1);
</script>