Switch.vue 549 Bytes
<template>
  <el-switch
    v-model="inputVal"
    active-color="#13ce66"
    inactive-color="#ff4949"
    @change="handleChange"
  />
</template>
<script>
export default {
  name: 'RcSwitch',
  components: {},
  props: {
    value: {
      type: Boolean,
      default: false
    }
  },
  data() {
    return {
      inputVal: this.value
    }
  },
  computed: {},
  watch: {
    value(val) {
      this.inputVal = val
    }
  },
  created() {},
  mounted() {},
  methods: {
    handleChange(e) {
      this.$emit('input', e)
    }
  }
}
</script>