Created
March 2, 2017 21:20
-
-
Save MarGul/59aa8dda85b67e2c62aad94b214469d8 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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