2021-10-21 22:36:48 +02:00
|
|
|
<template>
|
2023-04-22 10:24:19 +02:00
|
|
|
<span class="ceaaebcd" :class="{ [$style.isPlus]: isPlus, [$style.isMinus]: isMinus, [$style.isZero]: isZero }">
|
2021-10-22 08:33:56 +02:00
|
|
|
<slot name="before"></slot>{{ isPlus ? '+' : '' }}{{ number(value) }}<slot name="after"></slot>
|
2021-10-21 22:36:48 +02:00
|
|
|
</span>
|
|
|
|
</template>
|
|
|
|
|
2023-04-22 10:24:19 +02:00
|
|
|
<script lang="ts" setup>
|
|
|
|
import { computed } from 'vue';
|
2021-11-11 18:02:25 +01:00
|
|
|
import number from '@/filters/number';
|
2021-10-21 22:36:48 +02:00
|
|
|
|
2023-04-22 10:24:19 +02:00
|
|
|
const props = defineProps<{
|
|
|
|
value: number;
|
|
|
|
}>();
|
2021-10-21 22:36:48 +02:00
|
|
|
|
2023-04-22 10:24:19 +02:00
|
|
|
const isPlus = computed(() => props.value > 0);
|
|
|
|
const isMinus = computed(() => props.value < 0);
|
|
|
|
const isZero = computed(() => props.value === 0);
|
2021-10-21 22:36:48 +02:00
|
|
|
</script>
|
|
|
|
|
2023-04-22 10:24:19 +02:00
|
|
|
<style lang="scss" module>
|
|
|
|
.isPlus {
|
|
|
|
color: var(--success);
|
|
|
|
}
|
2021-10-21 22:36:48 +02:00
|
|
|
|
2023-04-22 10:24:19 +02:00
|
|
|
.isMinus {
|
|
|
|
color: var(--error);
|
|
|
|
}
|
2021-10-21 22:36:48 +02:00
|
|
|
|
2023-04-22 10:24:19 +02:00
|
|
|
.isZero {
|
|
|
|
opacity: 0.5;
|
2021-10-21 22:36:48 +02:00
|
|
|
}
|
|
|
|
</style>
|