Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

Odometer VueJS component

License

NotificationsYou must be signed in to change notification settings

JefferyHus/v-odometer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation



Odometer

About Vue-Odometer

Smoothly transitions numbers with ease. Use this library to give you application a smooth animation, only applicable on numbers, for more details about the OdometerJS pelase refer to:https://github.com/HubSpot/odometer

Installation

npm install v-odometer

NOTE

If you are getting the error of "Unknown Odometer keyword", this means that you are missing odometer library in your application, simply because the Odometer library is not yet exported as an AMD module and still only a commenJS file (refer to:AMD exporting issues).However if you are not building your applciation in a webpack envirment or similar, and you include VueJS file from a public cdn, then you are fine to include the./v-odometer/dist/main.prod.js, the Vue will be public in your window there for this component will be automatically integrated as a global component and you can simply use it directly insidde your html file:

...<vue-odometer:value="myValue"></vue-odometer>...

Usage

ECMAScript 6 (ES6)/ ECMAScript 2015 (ES2015)

To cherry pick the component, start by importing it in the file where it is being used:

importVueOdometerfrom'v-odometer/src'

Then add it to your component definition:

Vue.component('my-component',{components:{'vue-odometer':VueOdometer}// ...})

Or register it globally:

Vue.component('vue-odometer',VueOdometer);

ECMAScript 5 (ES5)

...<head><!-- Metas--><metaname="title"content="v-odometer"><metahttp-equiv="X-UA-Compatible"content="IE=edge"><metahttp-equiv="Content-Type"content="text/html; charset=utf-8"><metaname="viewport"content="width=device-width, initial-scale=1, shrink-to-fit=no"><metaname="description"content=""><metaname="keywords"content=""><title>Odometer - VueJS component</title><!-- include this style file, it contains all the themes provided from odometer--><linkrel="stylesheet"href="./your/path/to/main.css"><!-- don't forget to include the odometer library--><scriptsrc="https://cdnjs.cloudflare.com/ajax/libs/odometer.js/0.4.8/odometer.js"></script><!-- then load this component--><scripttype="text/javascript"src="./your/path/to/main.prod.js"></script></head><body><divid="app">...<vue-odometer :value="mynumber"class="myClassName"></vue-odometer>...</div></body>...
varapp=newVue({data:{mynumber:""}})

Properties:

value:{type:Number,default:()=>0},theme:{type:String,default:()=>'minimal'},format:{type:String,default:()=>'(.ddd),dd'},duration:{type:Number,default:()=>3000},className:{type:String,default:()=>'odometer'},animation:{type:String,default:()=>'count'},formatFunction:{type:Function},

[8]ページ先頭

©2009-2025 Movatter.jp