<template>
  <y-button :type="btnStyle" :disabled="disabled" :large="large" @click="click">
    <slot>{{label}}</slot>
  </y-button>
</template>
<script>
import { Button } from "../button";
import emitter from "yt-ui/src/mixins/emitter";
export default {
  name: "YRadioButton",
  components: { "y-button": Button },
  mixins: [emitter],
  props: {
    label: String
  },
  data() {
    return {
      disabled: false,
      large: false,
      actived: false,
      simple: false
    };
  },
  computed: {
    btnStyle() {
      if (this.simple) {
        return this.actived ? "radioBack" : "plain";
      } else {
        return this.actived ? "radioBorder" : "plain";
      }
    }
  },
  methods: {
    click(e) {
    	this.$emit('click',e);
      !this.selected &&
        this.dispatch("YRadioGroup", "radio-group-change", {
          value: this.label
        });
    }
  }
};
</script>
