I am attempting to pass an unlockTime
prop to a component1
in order for it to be rendered after the specified time has elapsed.
How can I make Vue continuously check if the current time is greater than the unlockTime
(
Date.now() > this.unlockTime ? true : false
)?
Main.vue:
<template>
<component1
:unlockTime="unlockTime">
</component1>
</template>
<script>
computed: {
unlockTime() {
return Date.now() + (5 * 60 * 1000)
}
}
</script>
Component1.vue
<template>
<div v-if="unlock">
Some Content Here
</div>
</template>
<script>
props: ["unlockTime"]
data(){
return{
unlock: Date.now() > this.unlockTime ? true : false
}
}
</script>