0.1.0 • Published 2 years ago

vue-count-to-vite v0.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

vue-count-to-vite

一个用 vite 打包的 vue 插件 vue3.0 组件, 基于潘佳辰的 2.0 组件改造而来

预览

在线地址

How to use?

npm install vue-count-to-vite

npm 安装使用

<template>
  <countTo :startVal="startVal" :endVal="endVal" :duration="3000"></countTo>
</template>

<script>
import countTo from 'vue-count-to-vite'
export default {
  components: { countTo },
  setup() {
    return {
      startVal: 0,
      endVal: 2017
    }
  }
}
</script>

cdn 使用方式

可以去代码仓库调试 (在 demo 文件夹里面使用 live server 启动就可以了)

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <link rel="icon" href="/favicon.ico" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Vite App</title>
  </head>
  <body>
    <script src="https://cdn.jsdelivr.net/npm/vue@3.2.31/dist/vue.global.min.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/vue-count-to-vite@0.0.7/dist/index.umd.min.js"></script>
    <div id="app">
      <count-to :end-value="200"></count-to>
    </div>
    <script>
      const app = Vue.createApp({
        setup(props) {}
      })
      app.component('CountTo', CountTo)
      app.mount('#app')
    </script>
  </body>
</html>

demo:

demo

Options

PropertyDescriptiontypedefault
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 suffixString''
useEasingis use easing functionBooleantrue
easingFnthe easing functionFunction

notes: when autoplay:true , it will auto start when startVal or endVal change

Functions

Function NameDescription
mountedCallbackwhen mounted will emit mountedCallback
startstart the countTo
pausepause the countTo
resumeresume the countTo
resetreset the countTo
pauseResumeauto pause/resume the countTo
0.1.0

2 years ago

0.0.9

2 years ago

0.0.8

2 years ago

0.0.7

2 years ago

0.0.6

2 years ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago