39 lines
799 B
Vue
Raw Normal View History

2025-06-05 09:42:18 +08:00
<template>
<el-radio-group v-model="radioValue" @change="change" v-bind="$props">
<el-radio-button v-for="dict in dictList" :key="dict.value" :label="dict.value">{{ dict.label }}</el-radio-button>
</el-radio-group>
</template>
<script>
export default {
props: ['radioData', 'size', 'value', 'showAll', 'filter'],
2025-06-05 18:34:40 +08:00
emits: ['change', 'input'],
2025-06-05 09:42:18 +08:00
data() {
return {
dictList: []
};
},
computed: {
radioValue: {
get() {
return this.value;
},
set(v) {
this.$emit('input', v);
}
}
},
2025-06-06 11:48:43 +08:00
async created() {
2025-06-05 09:42:18 +08:00
if (this.radioData) {
2025-06-06 11:48:43 +08:00
const resDic = await this.getDictionaryByKey(this.radioData);
this.dictList = resDic;
2025-06-05 09:42:18 +08:00
}
},
methods: {
change(val) {
this.$emit('change', val);
}
}
};
</script>