| 1 | <template> |
| 2 | <div class="flex items-center gap-3"> |
| 3 | <div class="w-16 shrink-0 text-sm">{{ label }}</div> |
| 4 | <n-progress type="line" :percentage :show-indicator="false" :status="color" :height="10" class="grow" /> |
| 5 | <div class="text-secondary w-28 shrink-0 text-right text-sm"> |
| 6 | {{ count }} / {{ total }} ({{ percentage.toFixed(1) }}%) |
| 7 | </div> |
| 8 | </div> |
| 9 | </template> |
| 10 | |
| 11 | <script setup lang="ts"> |
| 12 | import { NProgress } from "naive-ui" |
| 13 | import { computed } from "vue" |
| 14 | |
| 15 | const props = defineProps<{ |
| 16 | label: string |
| 17 | count: number |
| 18 | total: number |
| 19 | color: "success" | "warning" | "error" |
| 20 | }>() |
| 21 | |
| 22 | const percentage = computed(() => (props.total === 0 ? 0 : (props.count / props.total) * 100)) |
| 23 | </script> |