vue-count-to 数字滚动计数

724 阅读1分钟

安装:

npm install vue-count-to

示例:

<template>
  <countTo :startVal='startVal' :endVal='endVal' :duration='3000'></countTo>
</template>
 
<script>
  import countTo from 'vue-count-to';
  export default {
    components: { countTo },
    data () {
      return {
        startVal: 0,
        endVal: 2017
      }
    }
  }
</script>

api:

属性描述类型默认值
startValthe value you want to begin atNumber0
endValthe value you want to arrive atNumber2017
durationduration in millisecondNumber3000
autoplaywhen mounted autoplayBooleantrue
decimalsthe number of decimal places to showNumber0
decimalthe split decimalString.
separatorthe separatorString,
prefixthe prefixString''
suffixthe suffix String''
useEasingis use easing functionBooleantrue
easingFnthe easing functionFunction

插件地址:www.npmjs.com/package/vue…