<template>
  <el-col :xl="{span:span,offset:offset}" :lg="lgSpan" :md="mdSpan" :sm="smSpan" :xs="xsSpan">
    <el-form-item
      :label="$t(label)"
      :rules="[...requireRule(required, label, validate,trigger), ...rules]"
      :prop="prop"
      :label-width="labelWidth"
    >
    <el-switch v-model="$parent.model[prop]" :active-value="activeValue" :inactive-value="inActiveValue"
                       @change="val=> change(val)">
            </el-switch>
    </el-form-item>
  </el-col>


</template>

<script>
import mixin from '../../mixin'
import {isBlank} from "@/utils/common";

/**
 * 输入框组件
 */
export default {
  mixins: [mixin],
  props: {
    icon: {
      type: String
    },
    validate: {
      type: String
    },
    rules: {
      type: Array,
      default: () => []
    },
    span: {
      type: Number,
      default: 6
    },
    offset: {
      type: Number,
      default: 0
    },
    trigger: {
      type: String,
      default: 'blur'
    },
    labelWidth: {
      type: String,
      default: ''
    },
    lgSpan: {
      type: Number,
      default: 8
    },
    mdSpan: {
      type: Number,
      default: 8
    },
    smSpan: {
      type: Number,
      default: 12
    },
    Span: {
      type: Number,
      default: 24
    },
    xsSpan: {
      type: Number,
      default: 24
    },
    activeValue:{
      type:[String,Number],
      default:"1"
    },
    inActiveValue:{
      type:[String,Number],
      default:"0"
    }


  },
  computed: {
    showTip() {
      return this.disabled
    }
  },
  mounted() {

  },
  methods: {
    isBlank,
    change(val) {
      this.$emit('change', val)
    }
  }
}
</script>
