npm install vue-count-to
<template>
<countTo class="ICountUp" :startVal='startVal' :endVal='realTimeNum' :duration='2000' :decimals="decimals" :autoplay="autoplay"></countTo>
</template>
<script>
import countTo from 'vue-count-to';
export default {
props:['realTimeNum','decimals'],
data() {
return {
startVal: 0,
// endVal: 0,
incomeDur: 1000,
separator: ',',
decimal: '.',//小数点分隔符
prefix: '',//添加前缀
suffix: '',//添加后缀
// decimals: 2,//小数位数
autoplay:true,//默认为true,自动播放
}
},
components: { countTo },
}
</script>
<style lang="less" scoped>
.ICountUp{
font-weight: bold;
}
</style>
<m-countto :realTimeNum="datas.yingYongGNSL || 0" :decimals="0" />