I'm new in Vuejs, I'm using vue-countup-v2 npm package I install it, then import it in my Vue component, it's work perfect when I load the page but the point is I want to call the component CountUp when scroll down the screen not when I load the page. in the vu-countup-v2 package, there is a method called start() I can trigger it but I don't know-how.
here is the code:
<template>
<div id="main-wrapper" class="flex justify-around w-full p-12 my-12">
<CountUp
id="count-up"
:delay="delay"
:endVal="endVal[index]"
:options="options"
/>
</div>
</template>
<script>
import CountUp from 'vue-countup-v2';
import inViewport from 'in-viewport';
export default {
name: "NumberAnime",
components: {
CountUp,
},
data() {
return {
delay: 1000,
endVal: [40, 300000, 25000, 350],
options: {
useEasing: true,
useGrouping: true,
separator: ',',
decimal: '.',
prefix: '',
suffix: '',
}
}
},
mounted() {
inViewport('elementId', 'the function I want to callback')
},
}
</script>