mirror of
https://github.com/paricafe/misskey.git
synced 2024-11-29 10:06:44 -06:00
4f15b6f7c2
This reverts commit ada04c1932
.
47 lines
809 B
Vue
47 lines
809 B
Vue
<template>
|
|
<span class="ceaaebcd" :class="{ isPlus, isMinus, isZero }">
|
|
<slot name="before"></slot>{{ isPlus ? '+' : '' }}{{ number(value) }}<slot name="after"></slot>
|
|
</span>
|
|
</template>
|
|
|
|
<script lang="ts">
|
|
import { computed, defineComponent } from 'vue';
|
|
import number from '@/filters/number';
|
|
|
|
export default defineComponent({
|
|
props: {
|
|
value: {
|
|
type: Number,
|
|
required: true,
|
|
},
|
|
},
|
|
|
|
setup(props) {
|
|
const isPlus = computed(() => props.value > 0);
|
|
const isMinus = computed(() => props.value < 0);
|
|
const isZero = computed(() => props.value === 0);
|
|
return {
|
|
isPlus,
|
|
isMinus,
|
|
isZero,
|
|
number,
|
|
};
|
|
},
|
|
});
|
|
</script>
|
|
|
|
<style lang="scss" scoped>
|
|
.ceaaebcd {
|
|
&.isPlus {
|
|
color: var(--success);
|
|
}
|
|
|
|
&.isMinus {
|
|
color: var(--error);
|
|
}
|
|
|
|
&.isZero {
|
|
opacity: 0.5;
|
|
}
|
|
}
|
|
</style>
|