<template>
  <iSwitch v-model="switchVal" size="large" class="switch-btn">
    <span slot="open">开启</span>
    <span slot="close">关闭</span>
  </iSwitch>
</template>
<script>
  export default {
    props: {
      value: Boolean,
    },
    data() {
      return {
        switchVal: false,
      }
    },
    watch: {
      value: {
        immediate: true,
        handler(val) {
          this.switchVal = val;
        }
      },
      switchVal(val) {
        this.$emit('input', val);
      }
    }
  }
</script>
<style scoped>
.switch-btn {
  transform: scale(0.8);
  margin-left: -7px;
}
</style>