Make this code more readable if possible just print the code no explaining:<script…
- User
Make this code more readable if possible just print the code no explaining: import { onMounted, ref, reactive, watchEffect, defineProps } from 'vue'; import { comma } from '@/assets/countries.js'; import gsap from 'gsap';
const props = defineProps({ uuid: Number, country: [Number, String, Object], title: String, countryName: String, });
const identifier = ref(props.title.toLowerCase().replace(/ /g, '-')); const random = ref(Math.floor(Math.random() * 100) + 35);
onMounted(() => { const element = document.querySelector(
#${identifier.value}-${props.uuid}); if (!element) return; gsap.fromTo(element, { marginTop: 10, duration: 0.3, opacity: 0, x: -150, scale: 0.1, stagger: 0.8, }, { marginTop: 0, duration: 0.4, opacity: 1, x: 0, scale: 1.1, }, '-=0.39'); });const tweened = reactive({ number: 0, });
watchEffect(() => { const countryNumber = Number(props.country); if (isNaN(countryNumber)) return; gsap.to(tweened, { duration: 0.35, number: countryNumber }); });
function formatNumber() { return comma(tweened.number.toFixed(0)); }
- Assistanthtml