1
0
mirror of https://github.com/MisskeyIO/misskey synced 2024-12-23 11:08:22 +09:00
MisskeyIO/packages/frontend/src/components/MkNumber.vue

24 lines
433 B
Vue
Raw Normal View History

2022-12-31 20:36:49 +09:00
<template>
2022-12-31 21:10:25 +09:00
<span>{{ number(Math.floor(tweened.number)) }}</span>
2022-12-31 20:36:49 +09:00
</template>
<script lang="ts" setup>
import { reactive, watch } from 'vue';
2022-12-31 20:36:49 +09:00
import gsap from 'gsap';
import number from '@/filters/number';
const props = defineProps<{
value: number;
}>();
const tweened = reactive({
number: 0,
});
watch(() => props.value, (n) => {
2022-12-31 21:10:25 +09:00
gsap.to(tweened, { duration: 1, number: Number(n) || 0 });
2022-12-31 20:36:49 +09:00
}, {
immediate: true,
});
</script>