<template>
  <el-input 
    v-model="value" 
    :placeholder="attrs.placeholder?attrs.placeholder:'请输入内容'"
    :maxlength="attrs.maxlength"
    :minlength="attrs.minlength"
    :show-word-limit="attrs.showWordLimit"
    :clearable="attrs.clearable"
    :show-password="attrs.showPassword"
    :disabled="attrs.disabled"
    :size="attrs.size"
    :prefix-icon="attrs.prefixIcon"
    :suffix-icon="attrs.suffixIcon"
    :rows="attrs.rows"
    :readonly="attrs.readonly"
    @input="onChange"
    @clear="onChange"
    ></el-input>
</template>

<script lang="ts">
import { Component, Prop, Vue, Watch } from "vue-property-decorator";
import VueViews from '@/benyun/compVue/VueViews'
@Component
export default class ByInput extends VueViews {
  value:any='';


  created(){
    if(this.propConfig){
      this.setConfig(this.propConfig)
    }
    if(this.propValue){
      this.setValue(this.propConfig)
    }
  }
  mounted(){
    if(this.propValue){
      this.value = this.propValue
    }
  }

  setValue(data:any){
    if(data){
      this.value = (this as any).$lodash.cloneDeep(data);
    }else{
      this.value = '';
    }
  }

  getValue(){
    return (this as any).$lodash.cloneDeep(this.value);
  }

  // 清空数据
  clearValue(){
    this.value = ''
  }

  onChange(){
    this.$emit('onChange',this.value);
  }
}
</script>

<style lang="scss" scoped>

</style>