ToolSkeleton.uvue
1.39 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
<template>
<view class="tool-skeleton-container">
<!-- 模拟 Entrance 组件的网格布局 -->
<view class="tool-grid">
<view v-for="i in count"
:key="'tool-' + i"
class="tool-item-skeleton">
<!-- 图标占位 -->
<view class="tool-icon-placeholder"></view>
<!-- 文字占位 -->
<view class="tool-text-placeholder"></view>
</view>
</view>
</view>
</template>
<script setup lang="uts">
interface ToolSkeletonProps {
count: number
}
const props = withDefaults(defineProps<ToolSkeletonProps>(), {
count: 4
});
</script>
<style scoped lang="scss">
.tool-skeleton-container {
width: 100%;
padding: 16px;
box-sizing: border-box;
}
.tool-grid {
width: 100%;
display: flex;
flex-direction: row;
flex-wrap: wrap;
// ✅ UVUE 不支持 gap,需用 margin + 负margin 替代
// gap: 12px;
}
.tool-item-skeleton {
width: 25%; // ✅ UVUE 不支持 calc(),4列布局使用 25%
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding: 12px 8px;
box-sizing: border-box;
}
.tool-icon-placeholder {
width: 40px;
height: 40px;
border-radius: 12px;
background-color: #e8e8e8;
margin-bottom: 8px;
}
.tool-text-placeholder {
width: 50px;
height: 12px;
border-radius: 6px;
background-color: #e0e0e0;
}
</style>