Coder Social home page Coder Social logo

v-odometer's Introduction



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:

import VueOdometer from '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 -->
	<meta name="title" content="v-odometer">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
	<meta name="description" content="">
	<meta name="keywords" content="">
	<title>Odometer - VueJS component</title>
	<!-- include this style file, it contains all the themes provided from odometer -->
	<link rel="stylesheet" href="./your/path/to/main.css">
	<!-- don't forget to include the odometer library -->
	<script src="https://cdnjs.cloudflare.com/ajax/libs/odometer.js/0.4.8/odometer.js"></script>
	<!-- then load this component -->
	<script type="text/javascript" src="./your/path/to/main.prod.js"></script>
</head>
<body>
	<div id="app">
		...
		<vue-odometer :value="mynumber" class="myClassName"></vue-odometer>
		...
	</div>
</body>
...
var app = new Vue({
	data: {
		mynumber: ""
	}
})

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.