Skip to content

Instantly share code, notes, and snippets.

@MarGul
Created March 2, 2017 21:20
Show Gist options
  • Save MarGul/59aa8dda85b67e2c62aad94b214469d8 to your computer and use it in GitHub Desktop.
Save MarGul/59aa8dda85b67e2c62aad94b214469d8 to your computer and use it in GitHub Desktop.
<template>
<span class="timer-component">
{{ now }}
</span>
</template>
<script>
export default {
props: ['ends'],
data() {
return {
timer: null,
now: new Date()
}
},
computed: {
},
mounted() {
this.timer = setInterval(() => {
this.now.setSeconds(this.now.getSeconds() + 1);
console.log(this.now);
if (this.now == 5) {
this.$emit('ended');
}
}, 1000);
}
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment