43 lines
952 B
Vue
43 lines
952 B
Vue
<template>
|
|
<el-radio-group v-model="radioValue" @change="change" v-bind="$props">
|
|
<el-radio-button v-for="dict in dictList" :key="dict.value" :value="dict.value" :label="dict.value">{{ dict.label }}</el-radio-button>
|
|
</el-radio-group>
|
|
</template>
|
|
|
|
<script>
|
|
export default {
|
|
props: ['radioData', 'radioList', 'size', 'value', 'showAll', 'filter'],
|
|
emits: ['change', 'input'],
|
|
data() {
|
|
return {
|
|
dictList: []
|
|
};
|
|
},
|
|
computed: {
|
|
radioValue: {
|
|
get() {
|
|
return this.value;
|
|
},
|
|
set(v) {
|
|
this.$emit('input', v);
|
|
}
|
|
}
|
|
},
|
|
async created() {
|
|
if (this.radioList && this.radioList.length > 0) {
|
|
this.dictList = this.radioList;
|
|
} else {
|
|
if (this.radioData) {
|
|
const resDic = await this.getDictionaryByKey(this.radioData);
|
|
this.dictList = resDic;
|
|
}
|
|
}
|
|
},
|
|
methods: {
|
|
change(val) {
|
|
this.$emit('change', val);
|
|
}
|
|
}
|
|
};
|
|
</script>
|