<template>
  <div>
    <el-switch
      :value="value"
      class="y-switch"
      :active-value="activeValue"
      :inactive-value="inactiveValue"
      v-bind="$attrs"
      v-on="$listeners"
    >
    </el-switch>
  </div>
</template>

<script>
export default {
  name: "YSwitch",
  model: {
    prop: "value",
    event: "change",
  },
  props: {
    value: {
      default: 0,
    },
    activeValue: {
      default: 1,
    },
    inactiveValue: {
      default: 0,
    },
  },
  methods: {},
};
</script>

<style lang="less" scoped>
:deep(.el-switch) {
  .el-switch__label {
    position: absolute;
    display: none;
    color: #fff;
  }
  .el-switch__label--right {
    z-index: 1;
    left: 0px; /*不同场景下可能不同，自行调整*/
  }
  .el-switch__label--left {
    z-index: 1;
    right: 0px; /*不同场景下可能不同，自行调整*/
  }
  .el-switch__label.is-active {
    display: block;
  }
  .el-switch__core,
  .el-switch .el-switch__label {
    width: 60px !important; /*开关按钮的宽度大小*/
  }
}
</style>
