Instantly share code, notes, and snippets.

Embed
What would you like to do?
<template>
<div>
<div class="card text-white bg-info mb-3" v-if="seconds">
<div class="card-body">
<h2>{{ countdown }}</h2>
</div>
</div>
</div>
</template>
<script>
import * as moment from 'moment';
export default {
name: 'CountDown',
props: {
seconds: {
type: Number,
required: true
}
},
data () {
return {
countdown: null,
expires_in: null,
interval: null,
}
},
mounted () {
this.countdown = moment.utc(this.seconds).format('HH:mm:ss');
this.expires_in = this.seconds;
}
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment