MerchantListSkeleton.uvue
2.12 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
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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
<template>
<view class="merchant-skeleton-wrap">
<view class="skeleton-grid-container">
<view v-for="i in count" :key="i"
class="skeleton-item"
:class="[(i + 1) % 2 === 0 ? 'item-even' : '']">
<view class="skeleton-shimmer"></view>
<view class="skeleton-badge"></view>
<view class="skeleton-info">
<view class="skeleton-line skeleton-name"></view>
<view class="skeleton-line skeleton-id"></view>
</view>
</view>
</view>
</view>
</template>
<script setup lang="uts">
defineProps({
count: {
type: Number,
default: 6
}
});
</script>
<style scoped lang="scss">
.merchant-skeleton-wrap {
width: 100%;
box-sizing: border-box;
}
.skeleton-grid-container {
display: flex;
flex-direction: row;
flex-wrap: wrap;
width: 100%;
}
.skeleton-item {
min-height: 72px;
background-color: #f5f5f5;
border-radius: 14px;
padding: 12px 14px;
display: flex;
flex-direction: row;
align-items: center;
width: 48%;
margin-right: 4%;
margin-bottom: 12px;
box-sizing: border-box;
position: relative;
overflow: hidden;
// 每行第二个元素去掉右边距
&.item-even {
margin-right: 0;
}
// 流光效果层
.skeleton-shimmer {
position: absolute;
top: 0;
left: -100%;
width: 100%;
height: 100%;
background: linear-gradient(
90deg,
transparent 0%,
rgba(255, 255, 255, 0.3) 50%,
transparent 100%
);
pointer-events: none;
}
.skeleton-badge {
width: 36px;
height: 36px;
border-radius: 10px;
background-color: #e0e0e0;
margin-right: 10px;
flex-shrink: 0;
}
.skeleton-info {
flex: 1;
display: flex;
flex-direction: column;
justify-content: center;
min-width: 0;
.skeleton-line {
height: 12px;
border-radius: 6px;
background-color: #e0e0e0;
margin-bottom: 6px;
&:last-child {
margin-bottom: 0;
}
}
.skeleton-name {
width: 70%;
height: 13px;
}
.skeleton-id {
width: 50%;
height: 10px;
}
}
}
</style>