Skip to content

Zero dependency, simple animated-like number iteration directive for vue components

License

Notifications You must be signed in to change notification settings

tugayilik/vue-number-transition-directive

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

vue-number-transition-directive

Zero dependency, simple animated-like number iteration directive for vue components

Install

via npm

npm install vue-number-transition

via unpkg

https://unpkg.com/[email protected]/src/index.js

Usage

First import the directive and bind it to component's directives.

import NumberTransition from 'vue-number-transition';

export default {
    directives: {
        // ..
        NumberTransition
        // ..
    }
}

Then bind the directive on your target element;

<div id="count" v-number-transition="{ target: 500, iteration: 10, speed: 1000 }">

Parameters

target: The number that directive will count to. Can be computed property too.

iteration: The number of iterations until counter reaches to target number.

Example If you want to reach from 0 to 500 and iteration is 10, it will be increasing 50 by 50 (target/iteration) until 500.

speed: speed and iteration works together. The result of speed / iteration defines the interval speed between changes.

About

Zero dependency, simple animated-like number iteration directive for vue components

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published