1.开发环境 vue+vue-animate-number
2.电脑系统 windows10专业版
3.在应用 vue开发的过程中,咱们常常会应用一些插件来实现一些成果,上面我来分享一下是如何应用vue来实现动静展现数字。
4.废话不多说,间接上操作:

//装置 vue-animate-number插件npm install vue-animate-number

5.在main.js中引入

import Vue from 'vue'import VueAnimateNumber from 'vue-animate-number'Vue.use(VueAnimateNumber)

6.在vue模板中应用

<animate-number from="19999999":to="to" duration="10000" v-if="toshow" class="canimate"></animate-number>

7.配置参数

prop nametypedescriptiondefaultrequire
modestringauto or manual, trigger animation immediately or notautoN
fromnumbervalue, at which animate starts-Y
tonumbervalue, at which animate ends-Y
fromColorstringstart color for gradient, in hex format-N
toColorstringend color for gradient, in hex format-N
formatterFunctionvalue formatter for number in every step during the animationparseIntN
animateEndFunctioncallback after animation-N

8.本期的分享到了这里就完结啦,心愿对你有所帮忙,让咱们一起致力走向巅峰。