Added stop button

This commit is contained in:
Jeroen De Meerleer 2021-05-04 20:54:07 +02:00
parent a2158cac30
commit b4ff7be877
2 changed files with 14 additions and 6 deletions

View File

@ -2,7 +2,7 @@
<div id="app"> <div id="app">
<p class="error" v-if="wakeLockAvailable == false">Wake lock not available</p> <p class="error" v-if="wakeLockAvailable == false">Wake lock not available</p>
<Settings v-if="time == 0" v-on:set-time="setTime" v-on:set-playsound="setPlaySound"/> <Settings v-if="time == 0" v-on:set-time="setTime" v-on:set-playsound="setPlaySound"/>
<Timer v-if="time != 0" v-bind:time="time" v-bind:playsound="playsound"/> <Timer v-if="time != 0" v-bind:time="time" v-bind:playsound="playsound" v-on:set-time="setTime" v-on:set-playsound="setPlaySound"/>
</div> </div>
</template> </template>
@ -36,9 +36,8 @@ export default {
} else { } else {
return false; return false;
} }
} },
} },
} }
</script> </script>

View File

@ -1,5 +1,6 @@
<template> <template>
<div class="timer"> <div class="timer">
<div class="end" v-on:click="resetTime()">X</div>
<p v-if="warning == false" class="timeleft reverse">{{ countDown.toString() }}</p> <p v-if="warning == false" class="timeleft reverse">{{ countDown.toString() }}</p>
<p v-if="(warning == true) || (typeof warning == 'undefined')" class="timeout reverse"> <p v-if="(warning == true) || (typeof warning == 'undefined')" class="timeout reverse">
<img src="joker.png" alt="joker"> <img src="joker.png" alt="joker">
@ -35,9 +36,10 @@ export default {
wakeLock: null, wakeLock: null,
} }
}, },
mounted: function() {
},
methods: { methods: {
resetTime: function() {
this.$emit('set-time', 0);
},
timeleft: function(){ timeleft: function(){
this.countDown--; this.countDown--;
if(this.countDown == 0) { if(this.countDown == 0) {
@ -115,6 +117,13 @@ export default {
transform: scale(-1, -1); transform: scale(-1, -1);
} }
.end {
display: block;
position: absolute;
right: 1px;
top: 1px;
font-size: 32px;
}
} }
</style> </style>