<template>
  <div>
    <template v-if="type=='select'">
      <el-radio-group v-model="active" @change="onChange">
        <el-radio v-for="(el,i) in optionList" :key="i" :label="i"> 选项-{{ $asc2chart(65+i) }} </el-radio>
      </el-radio-group>
    </template>
    <template v-if="type=='judge'">
      <el-radio-group v-model="active" @change="onChange">
        <el-radio :label="0"> √ </el-radio>
        <el-radio :label="1"> × </el-radio>
      </el-radio-group>
    </template>

  </div>
</template>

<script>

export default {
    props: {
        value: {
            type: Number,
            default: 0
        },
        optionList: {
            type: Array,
            required: true
        },
        type: {
            type: String,
            required: true
        }
    },
    data() {
        return {
            active: 0
        };
    },
    watch: {
        value(val) {
            this.active = val;
        }
    },
    methods: {
        onChange(e) {
            this.$emit('input', e);
            this.$emit('change', e);
        }
    }
};
</script>

<style lang="scss" scoped>
</style>
