dcc
2024-06-13 3616db170333df7d668c97323344335b52c4153c
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
<template>
  <div class="w-full otc-select" :class="[isTwo ? 'zindex11' : 'zindex10']">
    <div class="otc-select-wrapper">
      <slot>
        <slot name="other"></slot>
        <!-- :class="{ active: value.title === item.title }" -->
        <div
          class="cursor-pointer item flex items-center"
          v-for="(item, index) in list"
          :key="index"
          @click="handleItemClick(item)"
        >
          <!-- isbg 表示需要币种的icon -->
          <div v-if="isbg" class="flex items-center">
            <img
              v-if="isTwo"
              class="w-22 h-22 mx-10"
              :src="`${
                ConfigURL.HOST_URL
              }/symbol/${item.title?.toLowerCase()}.png`"
              alt=""
            />
            <div v-if="!isTwo" class="currency_symbol">
              <span v-if="item.currencySymbol">{{
                item.currencySymbol.substring(0, 2)
              }}</span>
            </div>
          </div>
          <!-- 一般走这里 -->
          <div class="flex items-center" :class="[!isbg ? 'ml-10' : '']">
            <img
              v-if="isIcon"
              style="height: 20px"
              src="@/assets/images/c2c/want-buy/Group2060(1).png"
            />
            {{ item.title }}
          </div>
        </div>
      </slot>
    </div>
  </div>
</template>
 
<script>
import ConfigURL from "@/config/index";
 
export default {
  name: "OtcSelect",
  props: ["list", "value", "isTwo", "isbg", "isIcon"],
  emits: ["itemSelect"],
  data() {
    return {
      ConfigURL,
    };
  },
 
  methods: {
    handleItemClick(data) {
      this.$emit("itemSelect", data);
    },
  },
};
</script>
 
<style lang="scss" scoped>
@import "@/assets/css/c2c/init.scss";
 
.otc-select {
  box-shadow: 0px 0px 4px rgba(0, 0, 0, 0.2);
  border-radius: 5px;
  background: #fff;
 
  .item {
    &:hover {
      background: #f5f5f5;
    }
  }
}
 
.zindex10 {
  z-index: 10;
}
 
.zindex11 {
  z-index: 11;
}
.currency_symbol {
  width: 22px;
  height: 22px;
  background: #d35069;
  font-size: 12px;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  margin: 0 10px;
}
</style>