npm.io
0.0.5 • Published 9 years ago

vuejs-count-down

Licence
MIT
Version
0.0.5
Deps
2
Vulns
0
Weekly
0
Stars
8

vuejs-count-down

Vue.js countdown component

Software License Packagist Issues

Getting started

Installation

npm install --save vuejs-count-down
Usage
  • CommonJS: var CountDown = require('vuejs-count-down')
  • ES2015: import CountDown from 'vuejs-count-down'
components: {
    CountDown,
},
methods: {
    countDownProgress(time) {
        this.countDownSeconds = time
    },
    countDownFinished() {
        // restart when countdown ends
        this.$refs.countdown.$emit('restart')            
    }
}
<CountDown
    ref="countdown"
    :time="30"
    @onProgress="countDownProgress"
    @onFinish="countDownFinished"
>
    Time Remaining: {{countDownSeconds}} seconds.
</CountDown>
<!-- Time Remaining:30 seconds -->

Props

time
  • Type: Number
  • Required

Total number of time in seconds for the countdown.

autoStart
  • Type: Boolean
  • Default: true

Start countdown automatically when the component is created.

Methods

start

Start the countdown.

stop

Stop the countdown.

restart

Init the countdown and start again.

Events

onProgress

This event fires in progress (each second)

onFinish

This event fires when countdown ends.

Contributing

Please see CONTRIBUTING and CONDUCT for details.

Security

If you discover any security related issues, please email . instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.

Keywords