<template>
  <div
    class="cvux-check-icon"
    @click="updateValue"
  >
    <icon
      v-show="type === 'default' && value"
      type="success"
    />
    <icon
      v-show="type === 'plain' && value"
      type="success-circle"
    />
    <icon
      v-show="!value"
      type="circle"
    />
    <span><slot /></span>
  </div>
</template>
<script>
import Icon from '../icon'
export default {
  name: 'CheckIcon',
  components: {
    Icon
  },
  props: {
    value: {
      type: Boolean,
      default: false
    },
    type: {
      type: String,
      default: 'default'
    }
  },
  methods: {
    updateValue() {
      this.$emit('update:value', !this.value)
    }
  }
}
</script>
