<template>
    <div :class="groupClass">
        <slot></slot>
    </div>
</template>

<script>
import { prefix } from 'jdd-design/utils';
export default {
    name: `${prefix}-radio-group`,
    data() {
        return {
            model: {}
        };
    },
    provide() {
        return {
            jddRadioGroup: this
        };
    },
    props: {
        disabled: Boolean,
        value: [Boolean, Number, String]
    },
    computed: {
        groupClass() {
            let clsNames = [`${prefix}-radio-group`];
            return clsNames.join(' ');
        }
    },
    methods: {
        setValue(val) {
            this.model = val;
            this.$emit('input', val);
            this.$emit('change', val);
        }
    },
    mounted() {
        this.model = this.value;
    }
};
</script>
