<template>
  <el-checkbox v-model="model" v-bind="$attrs" v-on="$listeners" v-bind:disabled="isDisable">
    <slot></slot>
  </el-checkbox>
</template>

<script>
export default {
  props: {
    value: {
      type: String | Boolean,
      default: ''
    },
    disabled: {
      type: Boolean,
      default: false
    }
  },
  computed: {
    model: {
      get () {
        if(this.value)
          return true
        else 
          return false
      },
      set (newVal) {
        this.$emit('input', newVal?"X":"")
      }
    },
    mode () {
      return this.$store.state.Status.mode
    },
    isDisable: {
      get () {
        return this.mode === 'display' || this.disabled
      }
    }
  }
}
</script>