Git Product home page Git Product logo

vue3-flip-countdown's Introduction

vue3-flip-countdown

Customize Countdown timer with Flip Animation for Vue 3.x

vue3-flip-countdown.netlify.app

Netlify Status

Table of contents

Installation

npm i vue3-flip-countdown --save

Global Usage

main.js

import { createApp } from 'vue'
import App from './App.vue'
import Countdown from 'vue3-flip-countdown'
createApp(App).use(Countdown).mount('#app')

App.vue

<template>
  <vue3-flip-countdown />
</template>

<script>

export default {
  name: 'App',
  components: {
  }
}
</script>

Single File Component Usage

<template>
  <Countdown />
</template>

<script>
import {Countdown} from 'vue3-flip-countdown'
export default {
  name: 'App',
  components: {
    Countdown
  }
}
</script>

Emits

Name Description
timeElapsed event that created when the time came

Props

Name Type Default
deadlineISO String
YYYY-MM-DDTHH:mm:ss.sssZ
deadline String
YYYY-MM-DD HH:mm:ss
32d,0h,0m,10s
deadlineDate Date
countdownSize String 3rem
labelSize String 1.2rem
flipAnimation Boolean true
mainColor String '#EC685C'
secondFlipColor String props.mainColor
mainFlipBackgroundColor String '#222222'
secondFlipBackgroundColor String '#393939'
labelColor String '#222222'
showLabels Boolean true
stop Boolean
showDays Boolean true
showHours Boolean true
showMinutes Boolean true
showSeconds Boolean true
labels Object {days: 'Days',hours: 'Hours',minutes: 'Minutes',seconds: 'Seconds',}

References

Requirements

  • Vue version 3.x.x

License

MIT Copyright (c) 2021, Emre Coşkunçay

vue3-flip-countdown's People

Contributors

coskuncay avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

vue3-flip-countdown's Issues

Long delay before flip clock countdown starts

When entering the page, about a second passes before the clock is initialized and the countdown starts. Until then, there are only 00 everywhere.

I am using single file component usage.

timeElapsed emit

Hello!
does emit work if I pass in a component a deadline that is already gone?

how use this countdown in nuxt 3 ?

i get error ReferenceError: document is not defined into nuxt3 component

ReferenceError: document is not defined
at addStyle (/home/navas/Desktop/Nuxt/Front-Nuxt/node_modules/vue3-flip-countdown/dist/vue3-flip-countdown.common.js:6434:22)

Want to use elapsed event.

I would like to hide the flip timer after elapsed, and change it to the text.

I think Vue2 version (I mean the original flip countdown) has the event.
So, I want it too for vue3-flip-countdown.

Error at the time elapsed.

When the time elapsed, the error below would be shown.

Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'toString')
    at Proxy.twoDigits (vue3-flip-countdown.common.js?243e:25699)
    at eval (vue3-flip-countdown.common.js?243e:25472)
    at renderList (runtime-core.esm-bundler.js?5c40:5798)
    at Proxy.render (vue3-flip-countdown.common.js?243e:25459)
    at renderComponentRoot (runtime-core.esm-bundler.js?5c40:464)
    at ReactiveEffect.componentUpdateFn [as fn] (runtime-core.esm-bundler.js?5c40:4400)
    at ReactiveEffect.run (reactivity.esm-bundler.js?a1e9:160)
    at callWithErrorHandling (runtime-core.esm-bundler.js?5c40:6737)
    at flushJobs (runtime-core.esm-bundler.js?5c40:6976)

Enhancement: Updating the deadline

I use this component to show a countdown and it works nicely for this (and looks great, too!).

In my usecase the "deadline" can be updated though. I think currently this doesn't work correctly, as the counter doesn't reflect the updated deadline. I use the following to force Vue to rerender the component when the property changes:

<Countdown :key="myDeadline"/>

This works, but doesn't really look great as each counter briefly resets to 0 and then again to the new value.

I think for this use case it would be great if this worked seamlessly and maybe even with a small effect that properly "flips" the counters. Think of how this looks in old-time flip displays at the airport or train station, e.g. like here: https://www.youtube.com/watch?v=cj32w5z81Ak

Time increase is also important

The component can be used for countdown. If this component is used to indicate how long a user is currently online, this component will not be available.

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.