<template>
  <div class="relative input-box">
    <slot name="icon"></slot>
    <input type="text" v-model="currentActive" :class="[cls,'form-control']"
           @focus="isFocus=true" :placeholder="placeholder" @blur="isFocus=false">
    <slot name="placeholder" v-if="!placeholder&&!isFocus" @click="hhh"></slot>
  </div>

</template>

<script>
  export default {
    name: "ZghInput",
    props: {
      value: {
        type: String,
        default: ''
      },
      cls: {
        type: String,
        default: ''
      },
      placeholder: {
        type: String,
        default: ''
      }

    },
    data() {
      return {
        currentActive: this.value,
        isFocus: false
      }
    },
    watch: {
      currentActive(val) {
        this.$emit('input', val);
      },
      value() {
        this.currentActive = this.value;
      }
    },
    computed: {},
    mounted() {

    },
    methods: {
      hhh() {
        console.log(12323)
      }
    }
  }
</script>

<style lang="less" scoped>
  @import url("../../assets/config.less");

  .input-box {
    overflow: hidden;
    &.radius34 {
      border-radius: 34px;
    }
  }

  input {
    background: transparent;
    display: block;
    width: 100%;
    position: relative;
    z-index: 2;
    outline: none;
    border: none;
    outline-offset: 0px;
    box-shadow: none;
    &:focus {
      outline: none;
      outline-offset: 0px;
      box-shadow: none;
      border-color: #eee;
    }

  }
</style>
