<template>
<CountTo
:start-val="startVal"
:end-val="endVal"
:duration="duration"
:decimals="decimals"
/>
</template>
<script>
import CountTo from 'vue-count-to'
export default {
name: 'SCountTo',
components: {
CountTo,
},
props: {
start: {
type: [String, Number],
default: 0
},
end: {
type: [String, Number],
default: 2021
},
decimals: {
type: Number,
default: 0
},
duration: {
type: Number,
default: 1000
},
},
data () {
return {
startVal: 0,
endVal: 0,
}
},
watch: {
end (newVal, oldVal) {
this.startVal = oldVal
this.endVal = newVal
},
},
mounted () {
this.startVal = this.start
this.endVal = this.end
},
}
</script>