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