<template>
  <LabelBox
    :label="formItems.attrs?.label"
    :need-star="formItems.attrs?.needStar"
    :width="formItems.attrs?.width"
  >
    <el-input
      v-model="value"
      size="mini"
      :placeholder="formItems.attrs?.placeholder || '请填写'"
      v-bind="formItems.attrs"
      v-on="formItems.events"
      @input="handleInputEvent"
      @change="handleChangeEvent"
      @clear="handleClearEvent"
    >
      <template
        v-if="formItems.attrs?.prepend"
        slot="prepend"
      >{{
        formItems.attrs.prepend
      }}</template>
      <template
        v-if="formItems.attrs?.append"
        slot="append"
      >{{
        formItems.attrs.append
      }}</template>
    </el-input>
  </LabelBox>
</template>

<script>
import LabelBox from '../labelBox/index.vue';
import fieldMixin from '../fieldMixin';

export default {
  components: {
    LabelBox,
  },
  mixins: [fieldMixin],
  props: {
    formItems: {
      type: Object,
      default: () => {},
    },
    value: {
      type: String,
      default: '',
    },
  },
};
</script>
<style lang="scss" scoped>
::v-deep.el-input {
  height: 32px;
  line-height: 32px;
}

::v-deep.input-box {
  height: 32px;
}

::v-deep.el-input .el-input__icon {
  height: 32px;
  line-height: 25px;
  margin-left: -6px;
}

::v-deep.el-input .el-input-group__prepend {
  box-sizing: border-box;
  padding: 0 10px;
  height: 32px;
  line-height: 32px;
  border: none;
}

::v-deep.el-input .el-input__inner {
  height: 32px;
  line-height: 32px;
}
::v-deep.el-input .el-input__inner::placeholder {
  color: #fff;
}

::v-deep.el-input--prefix .el-input__inner {
  padding-left: 19px;
}
</style>

