2025-11-16 14:43:35 +08:00
|
|
|
<template>
|
|
|
|
|
<div class="data-field">
|
|
|
|
|
<img v-if="icon" :src="icon" :alt="label" class="data-field__icon" />
|
|
|
|
|
<span class="data-field__label">{{ label }}</span>
|
|
|
|
|
<span class="data-field__value" :class="valueClass">{{ value }}</span>
|
|
|
|
|
<span v-if="unit" class="data-field__unit" :class="valueClass">{{ unit }}</span>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script setup>
|
|
|
|
|
import { computed } from 'vue'
|
|
|
|
|
|
|
|
|
|
const props = defineProps({
|
|
|
|
|
label: {
|
|
|
|
|
type: String,
|
|
|
|
|
required: true
|
|
|
|
|
},
|
|
|
|
|
value: {
|
|
|
|
|
type: [String, Number],
|
|
|
|
|
required: true
|
|
|
|
|
},
|
|
|
|
|
unit: {
|
|
|
|
|
type: String,
|
|
|
|
|
default: ''
|
|
|
|
|
},
|
|
|
|
|
icon: {
|
|
|
|
|
type: String,
|
|
|
|
|
default: ''
|
|
|
|
|
},
|
|
|
|
|
colorType: {
|
|
|
|
|
type: String,
|
|
|
|
|
default: '',
|
|
|
|
|
validator: (value) => ['', 'success', 'warning', 'danger'].includes(value)
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
const valueClass = computed(() => {
|
|
|
|
|
return props.colorType ? `text--${props.colorType}` : ''
|
|
|
|
|
})
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<style scoped lang="scss">
|
|
|
|
|
@use '@/styles/mixins.scss' as *;
|
|
|
|
|
@use '../../assets/styles/common.scss' as *;
|
|
|
|
|
|
|
|
|
|
.data-field {
|
|
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
|
|
|
|
gap: vw(8);
|
2025-11-19 15:23:17 +08:00
|
|
|
padding: vh(4) vw(10);
|
2025-11-16 14:43:35 +08:00
|
|
|
background: url('../../assets/images/DataField/快速感知_bg.png') no-repeat center center;
|
|
|
|
|
background-size: 100% 100%;
|
|
|
|
|
|
|
|
|
|
&__icon {
|
|
|
|
|
width: vw(24);
|
2025-11-19 15:23:17 +08:00
|
|
|
height: vh(24);
|
2025-11-16 14:43:35 +08:00
|
|
|
flex-shrink: 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
&__label {
|
|
|
|
|
color: var(--text-white);
|
|
|
|
|
font-size: fs(14);
|
2025-11-20 16:59:33 +08:00
|
|
|
// font-family: SourceHanSansCN-Medium, sans-serif;
|
2025-11-16 14:43:35 +08:00
|
|
|
font-weight: 500;
|
|
|
|
|
white-space: nowrap;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
&__value {
|
|
|
|
|
color: var(--text-white);
|
2025-11-20 16:59:33 +08:00
|
|
|
font-size: fs(15);
|
2025-11-16 14:43:35 +08:00
|
|
|
font-family: PingFangSC-Semibold, sans-serif;
|
2025-11-20 16:59:33 +08:00
|
|
|
font-weight: 700;
|
2025-11-16 14:43:35 +08:00
|
|
|
flex: 1;
|
|
|
|
|
text-align: right;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
&__unit {
|
|
|
|
|
color: var(--text-white);
|
|
|
|
|
font-size: fs(14);
|
|
|
|
|
font-family: PingFangSC-Semibold, sans-serif;
|
|
|
|
|
font-weight: 600;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</style>
|