2023-02-14 04:02:41 +00:00
|
|
|
<template>
|
2023-04-08 00:01:42 +00:00
|
|
|
<span>{{ number(Math.floor(tweened.number)) }}</span>
|
2023-02-14 04:02:41 +00:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts" setup>
|
2023-04-08 00:01:42 +00:00
|
|
|
import { ref, reactive, watch } from "vue";
|
|
|
|
import gsap from "gsap";
|
|
|
|
import number from "@/filters/number";
|
2023-02-14 04:02:41 +00:00
|
|
|
|
|
|
|
const props = defineProps<{
|
|
|
|
value: number;
|
|
|
|
}>();
|
|
|
|
|
|
|
|
const tweened = reactive({
|
|
|
|
number: 0,
|
|
|
|
});
|
|
|
|
|
2023-04-08 00:01:42 +00:00
|
|
|
watch(
|
|
|
|
() => props.value,
|
|
|
|
(n) => {
|
|
|
|
gsap.to(tweened, { duration: 0.6, number: Number(n) || 0 });
|
|
|
|
},
|
|
|
|
{
|
|
|
|
immediate: true,
|
|
|
|
}
|
|
|
|
);
|
2023-02-14 04:02:41 +00:00
|
|
|
</script>
|