yumechi-no-kuni/packages/frontend/src/components/MkNumber.vue
Kagami Sascha Rosylight 63df2c851e
refactor: remove all unused imports (#9951)
Co-authored-by: tamaina <tamaina@hotmail.co.jp>
2023-02-16 23:09:41 +09:00

23 lines
433 B
Vue

<template>
<span>{{ number(Math.floor(tweened.number)) }}</span>
</template>
<script lang="ts" setup>
import { reactive, watch } from 'vue';
import gsap from 'gsap';
import number from '@/filters/number';
const props = defineProps<{
value: number;
}>();
const tweened = reactive({
number: 0,
});
watch(() => props.value, (n) => {
gsap.to(tweened, { duration: 1, number: Number(n) || 0 });
}, {
immediate: true,
});
</script>