Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

vue-awesome-countdown

Package Overview
Dependencies
Maintainers
1
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vue-awesome-countdown

Vue countdown plugin.

  • 1.0.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2.5K
decreased by-9.94%
Maintainers
1
Weekly downloads
 
Created
Source

vue-awesome-countdown

npm version Build Status Monthly Downloads License: MIT

Countdown plug-in with high performance and high accuracy for Vue2.5.0+.

Installation

Install via NPM...

$ npm install vue-awesome-countdown --save

...and import and use the plugin like so:

import vueAwesomeCountdown from 'vue-awesome-countdown'

Vue.use(vueAwesomeCountdown)

Usage

<countdown :end-time="new Date().getTime() + 60000">
  <span
    slot="process"
    slot-scope="anyYouWantedScopName">{{ `Lefttime: ${anyYouWantedScopName.timeObj.ceil.m}:${anyYouWantedScopName.timeObj.ceil.s}` }}</span>
  <span slot="finish">Done!</span>
</countdown>
<countdown :end-time="new Date().getTime() + 60000">
  <span
    slot="process"
    slot-scope="{ timeObj }">{{ `Lefttime: ${timeObj.ceil.m}:${timeObj.ceil.s}` }}</span>
  <span slot="finish">Done!</span>
</countdown>

SSR (Nuxt)

<no-ssr>
  <countdown :end-time="new Date().getTime() + 60000">
    <span
      slot="process"
      slot-scope="{ timeObj }">{{ `Lefttime: ${timeObj.ceil.m}:${timeObj.ceil.s}` }}</span>
    <span slot="finish">Done!</span>
  </countdown>
</no-ssr>

Example demo

http://linquan.me/vue-awesome-countdown

Props

PropRequiredExplainTypeDefault
endTimewhen leftTime undefinedTime stamp of countdown end[String, Number, Date]null
leftTimewhen endTime undefinedUnit: millisecondNumber0
autoStartfalseRemaining milliseconds of countdown endBooleantrue
speedfalseUnit: millisecondNumber1000
tagfalseThe wrap tag nameStringspan

Data

The data can get it through slot-scop or methods.

DataExplainDefault
stateThe countdown run state, the states are beforeStart, stoped, process and finisedbeforeStart
attrsThe countdown component tag attributes{}
actualEndTimeActual countdown end timenull
timeObja{}
countdownTimerThe countdown timer function, Do not use as much as possible.null
startTimeThe countdown start time.null
runTimesCountdown run times (The onProcess methods run times)0
usedTimeThe total time consuming from the countdown to the end.0

Slots

Slot process and slot finish will not display at the same time.

nameslot-scopPositionDisplay condition
beforecomponent _self1Defined, Controllable display
processcomponent _self2On process
finishcomponent _self2On finish
defaultcomponent _self3Defined, Controllable display

Methods

The methods can be accesse through slot-scop or $refs.

MethodExplainParameters
startCountdownrestart
stopCountdownno
switchCountdownno
finishCountdownno
doCountdownno

Event

EventExplainParameters
onStartFunctions executed at the beginning of countdownvm
onProcessFunction executed when countdown is performedvm
onStopFunction executed when countdown stopsvm
onFinishFunction executed when countdown finishedvm

MIT License

Keywords

FAQs

Package last updated on 03 Nov 2018

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc