<template>
  <span :class="classes" @click="handleChange" :name="name">
    <radio-icon :value="currentValue" :disabled="disabled"></radio-icon>
    <span class="uif-radio-label" v-if="label">{{label}}</span>
    <slot v-if="$slots.default"></slot>
  </span>
</template>

<script>
import RadioIcon from './radio-icon'
import mixin from '../checkbox/mixin'
export default {
  name: 'u-radio',
  mixins: [mixin],
  components: {
    RadioIcon
  },
  data () {
    return {
      is: 'radio'
    }
  },
  methods: {
    handleChange () {
      if (!this.currentValue) {
        this.onChange(!this.currentValue)
      }
    }
  }
}
</script>
