<template>
  <el-input v-bind="$attrs" v-on="$listeners" class="b-input" ref="bInput">
    <template slot="prefix"><slot name="prefix" /></template>
    <template slot="suffix"><slot name="suffix" /></template>
  </el-input>
</template>

<script>
export default {
  name: 'AdbInput',
  props: {
    focused: {
      type: Boolean,
      default: false,
    },
  },
  mounted() {
    if (this.focused) {
      const timeout = setTimeout(() => {
        this.$refs.bInput.focus();
        clearTimeout(timeout);
      }, 200);
    }
  },
};
</script>

<style lang="scss" scoped>
.el-input--small {
  ::v-deep .el-input__inner {
    height: 36px !important;
    line-height: 36px !important;
    border-radius: 6px !important;
  }
}
.b-input {
  ::v-deep .el-input__inner {
    font-size: 14px;
    color: $shipber-text-color-black;
    &::placeholder {
      color: $shipber-text-color-text;
    }
  }
}
.b-input[show-word-limit] {
  ::v-deep .el-input__suffix {
    top: -36px;
  }
}
</style>
