<template>
    <!-- 类型 -->
    <div>
        {{ title }}：
        <el-radio-group v-model="radio" :disabled="disabled">
            <el-radio
                v-for="(item, index) in list"
                :key="index"
                :label="item.value"
                @change="$emit('item-change', item)"
            >{{ item.name }}</el-radio>
        </el-radio-group>
    </div>
</template>

<script>
export default {
    model: { prop: 'value', event: 'change' },
    props: {
        value: [String, Number],
        title: { type: String, default: '' },
        list: { type: Array, default: () => [] },
        disabled: { type: Boolean, default: false }
    },
    computed: {
        radio: {
            get () {
                return this.value
            },
            set (value) {
                this.$emit('change', value)
            }
        }
    }
}
</script>

<style lang="less" scoped>
.el-radio-group, .el-radio {
    display: block;
}
.el-radio {
    margin-top: 10px;
}
</style>
