Files
Nexus/frontend/src/components/watch/WatchMetricBar.vue
T
Nexus Agent 7a0001d8f4 fix(watch): 恢复指标进度条原三档配色
≥90% 红、70–89% 黄、<70% 绿。

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-12 05:29:54 +08:00

33 lines
774 B
Vue

<script setup lang="ts">
const props = defineProps<{
label: string
value: number | null | undefined
}>()
function barColor(v: number): string {
if (v >= 90) return 'error'
if (v >= 70) return 'warning'
return 'success'
}
function displayValue() {
return props.value != null ? `${props.value}%` : '—'
}
</script>
<template>
<div class="watch-metric-bar mb-1">
<div class="d-flex justify-space-between text-caption mb-0">
<span class="text-medium-emphasis">{{ label }}</span>
<span class="font-weight-medium">{{ displayValue() }}</span>
</div>
<v-progress-linear
:model-value="value ?? 0"
:color="value != null ? barColor(value) : 'grey'"
bg-opacity="0.2"
height="6"
rounded
/>
</div>
</template>