11
jhzh
2024-08-01 4ebbadfe4c8c7aa6404dcd9b126cc8265bf03c0d
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
<template>
  <div class="buy-input relative">
    <img
      class="w-40 h-40 absolute left-24"
      src="~@/assets/image/payment/search.png"
      alt=""
    />
    <input
      class="w-full box-border pl-80"
      :readonly="readonly"
      type="text"
      :value="value"
      :placeholder="placeholder"
      @input="changeVal"
      @focus="focus"
    />
  </div>
</template>
 
<script>
export default {
  name: "BuyInput",
  props: ["value", "placeholder", "isReadonly"],
  data() {
    return {
      readonly: false,
    };
  },
  mounted() {
    if (this.isReadonly) {
      this.readonly = this.isReadonly;
    } else {
      this.readonly = false;
    }
  },
  methods: {
    focus(e) {
      this.$emit("focus", e.target.value);
    },
    changeVal(e) {
      this.$emit("input", e.target.value);
    },
  },
};
</script>
 
<style lang="scss" scoped>
input {
  border: none;
  outline: none;
}
 
.buy-input {
  width: 100%;
  height: 100%;
 
  img {
    top: 50%;
    transform: translateY(-50%);
  }
 
  input {
    width: 100%;
    height: 100%;
    border-radius: 50px;
 
    @include themify() {
      background: themed("input_background");
    }
 
    @include themify() {
      color: themed("text_color");
    }
  }
}
</style>