Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

@chenfengyuan/vue-countdown

fengyuanchen136.8kMIT2.1.2TypeScript support: included

Countdown component for Vue 3.

countdown, vue, vue3, vue-component, front-end, web

readme

vue-countdown

Coverage Status Downloads Version Gzip Size

Countdown component for Vue 3. For Vue 2, check out the v1 branch.

Main npm package files

dist/
├── vue-countdown.js         (UMD, default)
├── vue-countdown.min.js     (UMD, compressed)
├── vue-countdown.esm.js     (ECMAScript Module)
├── vue-countdown.esm.min.js (ECMAScript Module, compressed)
└── vue-countdown.d.ts       (TypeScript Declaration File)

Getting started

Installation

Using npm:

npm install vue@3 @chenfengyuan/vue-countdown@2

Using pnpm:

pnpm add vue@3 @chenfengyuan/vue-countdown@2

Using Yarn:

yarn add vue@3 @chenfengyuan/vue-countdown@2

Using CDN:

<script src="https://unpkg.com/vue@3"></script><!-- Vue.js is required -->
<script src="https://unpkg.com/@chenfengyuan/vue-countdown@2"></script>

Usage

import { createApp } from 'vue';
import VueCountdown from '@chenfengyuan/vue-countdown';

const app = createApp({});

app.component(VueCountdown.name, VueCountdown);
<vue-countdown :time="2 * 24 * 60 * 60 * 1000" v-slot="{ days, hours, minutes, seconds }">
  Time Remaining:{{ days }} days, {{ hours }} hours, {{ minutes }} minutes, {{ seconds }} seconds.
</vue-countdown>
<!-- <span>Time Remaining:1 days, 23 hours, 59 minutes, 59 seconds.</span> -->

Browser support

Same as Vue 3.

Versioning

Maintained under the Semantic Versioning guidelines.

License

MIT © Chen Fengyuan

changelog

2.1.2 (2023-08-26)

Bug Fixes

  • reset the end time on start when the autoStart prop is set to false (10aef5f), closes #93

2.1.1 (2023-03-18)

Bug Fixes

  • update the total milliseconds correctly (88db379), closes #43

2.1.0 (2022-08-13)

Features

2.0.0 (2022-02-07)

2.0.0-rc (2021-06-12)

2.0.0-beta (2021-02-21)

2.0.0-alpha (2021-02-11)

  • refactor!: upgrade to Vue 3 (c998a67)

BREAKING CHANGES

  • drop support for Vue 2.

1.1.5 (2020-02-25)

1.1.4 (2019-12-21)

Bug Fixes

  • avoid losing time for each progress (0350c13), closes #43

1.1.3 (2019-09-14)

Bug Fixes

  • continue counting down only when the current tab is visible (bb5e6ba), closes #37

1.1.2 (2019-04-16)

Bug Fixes

  • add missing properties for the progress event (96b065a), closes #34

1.1.1 (2019-04-05)

Bug Fixes

  • improve browser compatibility (f144fe2)
  • replace setTimeout with requestAnimationFrame (#33) (5f1d632)

1.1.0 (2018-12-23)

Features

Reverts

1.0.1 (2018-11-09)

Bug Fixes

  • start immediately when mounted (40fb7f5), closes #1

1.0.0 (2018-10-21)