VUE Animate Number 插件---------一个数字自加的插件
npm install vue-animate-numbermain.js<template><div><animate-numberfrom="1"to="10"duration="1000&
·
npm install vue-animate-number
main.js
<template>
<div>
<animate-number
from="1"
to="10"
duration="1000"
easing="easeOutQuad"
:formatter="formatter"
></animate-number>
<!-- parseInt as default formatter -->
<animate-number from="1" to="10"></animate-number>
<!-- manually start animation by click -->
<animate-number ref="myNum" from="0" to="10" mode="manual" :formatter="formatter"></animate-number><br>
<button type="button" @click="startAnimate()"> animate! </button>
</div>
</template>
<script>
export default {
methods: {
formatter: function (num) {
return num.toFixed(2)
},
startAnimate: function () {
this.$refs.myNum.start()
}
}
}
</script>
API
<animate-number
mode="auto"
duration="1000"
:from="from"
:to="to"
from-color="#44CC00"
to-color="#ec4949"
:formatter="formatter"
:animate-end="animateEnd">
</animate-number>
效果图
更多推荐
已为社区贡献3条内容
所有评论(0)