<template>
       <i-switch v-model="switch1" size="large" :true-color="truecolor"  :false-color="falsecolor" @on-change="onchange">
        <span slot="open">{{ openlabel}}</span>
        <span slot="close">{{closelabel}}</span>
      </i-switch>
</template>
<script>
import { refQuery } from "@/api/meta";
export default {
  name: "switchs",
  components: {},
  model: {
    prop: "value",
    event: "change"
  },
  props: {
    value: {
      type: Boolean,
      default() {
        return false;
      }
    },
    truecolor:String,
    falsecolor:String,
    openlabel:String,
    closelabel:String,
    propname:String
  },
  data() {
    return {
      switch1: this.value,
      currentprop:this.propname
    };
  },
  watch: {
    value(nv, ov) {
      this.switch1 = nv;
    }
  },
  methods: {
    onchange(v) {
      this.$emit("change", this.switch1);
      this.$emit("changewithprop", this.switch1,this.currentprop);
    }
  },
  created() {

  },
  mounted() {}
};
</script>
<style>
</style>
