2025-10-27 13:21:43 +08:00
|
|
|
<template>
|
|
|
|
|
<view class="metric-container" :style="{ gridTemplateColumns: `repeat(${columns}, 1fr)` }">
|
|
|
|
|
<view class="metric-item" v-for="(item, index) in items" :key="index">
|
|
|
|
|
<view class="metric-value">
|
|
|
|
|
{{ item.value }}
|
|
|
|
|
</view>
|
|
|
|
|
<view class="metric-label">{{ item.label }}</view>
|
|
|
|
|
<view v-if="item.unit" class="metric-unit">{{ item.unit }}</view>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
export default {
|
|
|
|
|
name: 'MetricCard',
|
|
|
|
|
props: {
|
|
|
|
|
items: {
|
|
|
|
|
type: Array,
|
|
|
|
|
required: true
|
|
|
|
|
},
|
|
|
|
|
columns: {
|
|
|
|
|
type: Number,
|
|
|
|
|
default: 3
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<style scoped>
|
2025-10-29 15:38:20 +08:00
|
|
|
/* 简洁指标卡片容器 */
|
2025-10-27 13:21:43 +08:00
|
|
|
.metric-container {
|
|
|
|
|
display: grid;
|
|
|
|
|
gap: 20rpx;
|
2025-10-29 15:38:20 +08:00
|
|
|
padding: 30rpx;
|
2025-10-27 13:21:43 +08:00
|
|
|
box-sizing: border-box;
|
2025-10-29 15:38:20 +08:00
|
|
|
background: #fff;
|
2025-10-27 13:21:43 +08:00
|
|
|
}
|
|
|
|
|
|
2025-10-29 15:38:20 +08:00
|
|
|
/* 单个指标项 */
|
2025-10-27 13:21:43 +08:00
|
|
|
.metric-item {
|
|
|
|
|
display: flex;
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
justify-content: center;
|
|
|
|
|
align-items: center;
|
2025-10-29 15:38:20 +08:00
|
|
|
padding: 30rpx 20rpx;
|
|
|
|
|
background: #f8f9fa;
|
|
|
|
|
border-radius: 12rpx;
|
|
|
|
|
border: 1rpx solid #e8e8e8;
|
|
|
|
|
transition: all 0.2s ease;
|
|
|
|
|
|
|
|
|
|
&:active {
|
|
|
|
|
background: #f0f2f5;
|
|
|
|
|
}
|
2025-10-27 13:21:43 +08:00
|
|
|
}
|
|
|
|
|
|
2025-10-29 15:38:20 +08:00
|
|
|
/* 指标数值 */
|
2025-10-27 13:21:43 +08:00
|
|
|
.metric-value {
|
|
|
|
|
font-size: 48rpx;
|
|
|
|
|
font-weight: 600;
|
|
|
|
|
margin-bottom: 16rpx;
|
|
|
|
|
line-height: 1.2;
|
2025-10-29 15:38:20 +08:00
|
|
|
color: #1a73e8;
|
2025-10-27 13:21:43 +08:00
|
|
|
}
|
|
|
|
|
|
2025-10-29 15:38:20 +08:00
|
|
|
/* 单位 */
|
2025-10-27 13:21:43 +08:00
|
|
|
.metric-unit {
|
|
|
|
|
font-size: 0.7em;
|
|
|
|
|
color: #999;
|
|
|
|
|
margin-left: 8rpx;
|
|
|
|
|
}
|
|
|
|
|
|
2025-10-29 15:38:20 +08:00
|
|
|
/* 指标标签 */
|
2025-10-27 13:21:43 +08:00
|
|
|
.metric-label {
|
2025-10-29 15:38:20 +08:00
|
|
|
font-size: 26rpx;
|
2025-10-27 13:21:43 +08:00
|
|
|
color: #666;
|
2025-10-29 15:38:20 +08:00
|
|
|
letter-spacing: 1rpx;
|
2025-10-27 13:21:43 +08:00
|
|
|
text-align: center;
|
2025-10-29 15:38:20 +08:00
|
|
|
line-height: 1.5;
|
2025-10-27 13:21:43 +08:00
|
|
|
}
|
|
|
|
|
</style>
|