ToolSkeleton.uvue 1.39 KB
<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>