<template>
  <div class="tw-flex tw-flex-col">
    <input
      class="tw-bg-white tw-rounded-[12px] input-background"
      :id="input.id"
      :type="input.type"
      :value="value"
      :placeholder="input.placeHolder"
      v-model="inputVal"
    />
  </div>
</template>
<script>
  export default {
    name: "ElementInput",
    props: {
      input: {
        type: Object,
      },
      default: {
        type: String,
      },
    },
    data() {
      return {
        value: this.default ? this.default : "",
      };
    },
    mounted() {},
    watch: {
      default: {
        handler: function () {
          this.value = this.default;
        },
      },
    },

    computed: {
      inputVal: {
        get() {
          return this.value;
        },
        set(val) {
          this.value = val;
          this.$emit("change", val);
        },
      },
    },
  };
</script>
<style lang="scss" scoped>
  .input-background {
    background: url('@/assets/svg/search.svg') no-repeat 95% 50%;
    // background-position: right;
    background-size: 20px;
  }
</style>
