dcc
2024-06-13 24e2c4a6983d3ed1c67080b460f7e28f5e2e55f9
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
<template>
  <div class="buy-input relative">
    <img class="search-icon absolute left-6" src="../../../../../assets/image/payment/search.png" alt="" />
    <input class="w-full box-border pl-20" :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%;
  display: flex;
  align-items: center;
  font-size: 30px;
 
  img {
    top: 50%;
    transform: translateY(-50%);
  }
 
  input {
    width: 100%;
    height: 100%;
    border-radius: 50px;
    height: 80px;
    background: $input_background;
    color: $text_color;
  }
}
 
.search-icon {
  width: 40px;
  height: 40px;
}
</style>