1
李凌
2025-09-06 b7eb749eb71ae802f9868e3b099aa362e23d7cc0
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
<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 pt-10 pb-10" :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>
@import "@/assets/css/copy2.scss";
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;
    background: $input_background;
    color: $text_color;
  }
}
</style>