<!-- @desc:radio组件  @auth:周兴  @time:2022/6/14 15:47 -->
<template>
  <RadioGroup v-model="model" @on-change="handleChange">
    <Radio v-for="(item,index) in options" :key="index" :label="item.value" :value="item.value">{{item.label}}</Radio>
  </RadioGroup>
</template>

<script>
export default {
  name: "dk-radio",
  model: {
    prop: 'value',
    event: 'on-change'
  },
  props: {
    value: {
      type: [String, Number, Array],
      default: null
    },
    // 数据源
    options: {
      type: Array,
      default: null
    },
  },
  watch:{
    value(n,o){
      this.model = n;
    }
  },
  data(){
    return{
      model:null,
    }
  },
  methods:{
    /**
     * @desc   : 值改变
     * @author : 周兴
     * @date   : 2022/6/14 9:35
     */
    handleChange(e){
      this.$emit('on-change',e)
    },
  },
  created() {
    this.model = this.value;
  }
}
</script>

<style scoped>

</style>
