项目作者: xlsdg

项目描述 :
Vue.js component wrap for countUp.js
高级语言: Vue
项目地址: git://github.com/xlsdg/vue-countup-v2.git
创建时间: 2017-01-03T12:49:40Z
项目社区:https://github.com/xlsdg/vue-countup-v2

开源协议:MIT License

下载


vue-countup-v2

Vue.js component wrap for CountUp.js

Installation

  1. $ npm install --save countup.js vue-countup-v2

Usage

  1. <template>
  2. <div class="iCountUp">
  3. <ICountUp
  4. :delay="delay"
  5. :endVal="endVal"
  6. :options="options"
  7. @ready="onReady"
  8. ></ICountUp>
  9. </div>
  10. </template>
  11. <script type="text/babel">
  12. import ICountUp from 'vue-countup-v2';
  13. export default {
  14. name: 'demo',
  15. components: {
  16. ICountUp
  17. },
  18. data() {
  19. return {
  20. delay: 1000,
  21. endVal: 120500,
  22. options: {
  23. useEasing: true,
  24. useGrouping: true,
  25. separator: ',',
  26. decimal: '.',
  27. prefix: '',
  28. suffix: ''
  29. }
  30. };
  31. },
  32. methods: {
  33. onReady: function(instance, CountUp) {
  34. const that = this;
  35. instance.update(that.endVal + 100);
  36. }
  37. }
  38. };
  39. </script>
  40. <style scoped>
  41. .iCountUp {
  42. font-size: 12em;
  43. margin: 0;
  44. color: #4d63bc;
  45. }
  46. </style>

Properties

  • delay [Number]

    Optional;

  • endVal [Number]

    Required; The value you want to arrive at.

  • options [Object]

    Optional; Formatting/easing options object.

See more countUp.js

Static Methods

  • start
  • pauseResume
  • reset
  • update

Learn more countUp.js

License

MIT