You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

vue-count-to-vite

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vue-count-to-vite

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

0.1.0
latest
Source
npmnpm
Version published
Maintainers
1
Created
Source

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

FAQs

Package last updated on 02 Aug 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts