lxf
2025-07-07 93f9b248dd0eecbaa77006e5146c58c831d89d8e
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
<template>
  <div class="list-hot font-28">
    <div class="hotBox">
      <div v-for="item in listData" :key="item.id" class="box-border">
        <ul class="box-border flex flex-col w-full px-16" @click="onItemClick(item)">
          <li class="flex items-center justify-between mb-16">
            <p class="flex items-end items-center">
              <strong class="font-400">{{ item.symbol && item.symbol.toUpperCase() || '--' }}</strong>
              <span class="grey font-400">{{ item.name && item.name.replace(item.symbol.toUpperCase(), '') ||
                '--' }}</span>
              <span class="font-18" :class="item.change_ratio > 0 ? 'green' : 'red'">{{ item.change_ratio > 0
                ?
                '+' : '' }}{{ item.change_ratio }}%</span>
            </p>
          </li>
          <li class="mb-16">
            <p>
              <strong class="font-700 font-36" :class="item.change_ratio > 0 ? 'green' : 'red'">{{
                item.close || '--' }}</strong><br />
              <span class="grey font-400 font-22">≈ {{ currency.currency_symbol }}{{ item.close && (item.close
                *
                currency.rate).toFixed(2) || '--'
              }}</span>
            </p>
          </li>
        </ul>
      </div>
    </div>
  </div>
</template>
 
<script>
import { mapGetters } from 'vuex'
import { fixDate } from "@/utils";
export default {
  data() {
    return {
      fixDate
    }
  },
  components: {
  },
  props: {
    listData: {
      type: Array,
      default() {
        return []
      }
    }
  },
  computed: {
    ...mapGetters({ currency: 'home/currency' })
  },
  methods: {
    onItemClick(item) { // 点击进入合约交易
      this.$router.push({
        path: `/trendDetails/${item.symbol}`,
      })
    }
  }
}
</script>
 
<style lang="scss" scoped>
@import "@/assets/init.scss";
 
#cryptos {
  .list-hot {
    font-size: 26px;
 
    p {
      color: $text_color1;
    }
  }
 
  .red {
    color: #E35561
  }
 
  .green {
    color: $green
  }
 
  .grey {
    color: $text_color1;
  }
 
  .hotBox {
    display: flex;
 
    >div {
      flex: 1;
    }
  }
}
</style>