index.vue
1.1 KB
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="static-info">
<div v-for="(item, index) in list"
:key="index"
class="static-item"
:style="{ background: item.background }">
<div class="label">
{{ item.label }}
</div>
<div class="value">
{{ data[item.key] }}
</div>
</div>
</div>
</template>
<script>
export default {
name: "StaticInfo",
props: {
list: {
type: Array,
default: () => [],
},
data: {
type: Object,
default: () => ({}),
},
},
};
</script>
<style lang="scss" scoped>
.static-info {
display: flex;
align-items: center;
justify-content: space-between;
gap: 8px; /* 增加一点间距 */
padding: 8px 12px;
.static-item {
box-sizing: border-box;
padding: 12px;
flex: 1; /* 无论几个,都是平分剩余空间 */
border-radius: 8px;
font-size: 14px;
color: #ffffff;
min-width: 0; /* 防止内容过长撑破 flex 布局 */
.label {
margin-bottom: 5px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.value {
font-size: 20px;
font-family: "numberBold";
}
}
}
</style>