jhzh
2024-09-23 e678ec74066a2c5b5b3b404d3344bffbd3cf59bd
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
<template>
    <div class="list-hot">
        <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/utis";
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>
.list-hot {
    font-size: 26px;
 
    p {
        color: #868D9A;
    }
}
 
.red {
    color: #E35561
}
 
.green {
    color: #5EBA89
}
 
.grey {
    color: #868D9A
}
 
.hotBox {
    display: flex;
 
    >div {
        flex: 1;
    }
}</style>