chore: install prettier
This commit is contained in:
@@ -1,38 +1,45 @@
|
||||
<template>
|
||||
<div id="countdown">
|
||||
<div id="countdown-number"></div>
|
||||
<svg><circle r="18" cx="20" cy="20" color="red"></circle></svg>
|
||||
</div>
|
||||
<div id="countdown">
|
||||
<div id="countdown-number"></div>
|
||||
<svg>
|
||||
<circle
|
||||
r="18"
|
||||
cx="20"
|
||||
cy="20"
|
||||
color="red"
|
||||
></circle>
|
||||
</svg>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
export default {
|
||||
props: ['duration'],
|
||||
props: ["duration"],
|
||||
data() {
|
||||
return {
|
||||
timer: undefined,
|
||||
countdown: this.duration || 10
|
||||
}
|
||||
countdown: this.duration || 10,
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
var countdownNumberEl = document.getElementById('countdown-number')
|
||||
var countdownNumberEl = document.getElementById("countdown-number");
|
||||
countdownNumberEl.textContent = this.countdown;
|
||||
this.timer = setInterval(()=>this.startCount(), 1000)
|
||||
this.timer = setInterval(() => this.startCount(), 1000);
|
||||
},
|
||||
beforeDestroy() {
|
||||
clearInterval(this.timer)
|
||||
clearInterval(this.timer);
|
||||
},
|
||||
methods: {
|
||||
startCount() {
|
||||
this.countdown -= 1
|
||||
var countdownNumberEl = document.getElementById('countdown-number')
|
||||
this.countdown -= 1;
|
||||
var countdownNumberEl = document.getElementById("countdown-number");
|
||||
countdownNumberEl.textContent = this.countdown;
|
||||
if(this.countdown===0) {
|
||||
clearInterval(this.timer)
|
||||
this.$emit('close')
|
||||
if (this.countdown === 0) {
|
||||
clearInterval(this.timer);
|
||||
this.$emit("close");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
<style scoped>
|
||||
#countdown {
|
||||
@@ -72,4 +79,4 @@ export default {
|
||||
stroke-dashoffset: 113px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user