<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'],
  emits: ['change', 'input'],
  data() {
    return {
      dictList: []
    };
  },
  computed: {
    radioValue: {
      get() {
        return this.value;
      },
      set(v) {
        this.$emit('input', v);
      }
    }
  },
  async created() {
    if (this.radioData) {
      const resDic = await this.getDictionaryByKey(this.radioData);
      this.dictList = resDic;
    }
  },
  methods: {
    change(val) {
      this.$emit('change', val);
    }
  }
};
</script>
