SingleColumnSkeleton.uvue
1.88 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
<template>
<view class="single-column-skeleton-wrap">
<view v-for="i in count" :key="i" class="skeleton-item">
<view class="skeleton-shimmer"></view>
<view class="skeleton-left">
<view class="skeleton-avatar"></view>
</view>
<view class="skeleton-right">
<view class="skeleton-line skeleton-title"></view>
<view class="skeleton-line skeleton-subtitle"></view>
</view>
</view>
</view>
</template>
<script setup lang="uts">
defineProps({
count: {
type: Number,
default: 4
}
});
</script>
<style scoped lang="scss">
.single-column-skeleton-wrap {
width: 100%;
box-sizing: border-box;
}
.skeleton-item {
min-height: 92px;
background-color: #f5f5f5;
border-radius: 16px;
padding: 18px;
display: flex;
flex-direction: row;
align-items: center;
margin-bottom: 16px;
position: relative;
overflow: hidden;
&:last-child {
margin-bottom: 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-left {
margin-right: 16px;
flex-shrink: 0;
.skeleton-avatar {
width: 52px;
height: 52px;
border-radius: 26px;
background-color: #e0e0e0;
}
}
.skeleton-right {
flex: 1;
display: flex;
flex-direction: column;
justify-content: center;
.skeleton-line {
height: 14px;
border-radius: 7px;
background-color: #e0e0e0;
margin-bottom: 8px;
&:last-child {
margin-bottom: 0;
}
}
.skeleton-title {
width: 60%;
height: 16px;
}
.skeleton-subtitle {
width: 40%;
height: 12px;
}
}
}
</style>