示例工程 24-vue3-rewrite
24-vue3-rewrite/app/src/components/StatCard.vue
<script setup lang="ts">
defineProps<{
label: string;
value: number | string;
testid: string;
}>();
</script>
<template>
<div class="card stat">
<div class="muted">{{ label }}</div>
<div class="stat-value" :data-testid="testid">{{ value }}</div>
</div>
</template>
<style scoped>
.stat {
padding: 8px 12px;
}
.stat-value {
font-size: 20px;
font-weight: 600;
}
</style>