As a beginner in JavaScript and Vue, I am experimenting with a progress bar and encountering an issue. When the progress bar reaches 0, the data disappears as intended. However, I want the data to reappear when there is progress without needing to refresh the page. Unfortunately, my current code doesn't allow the data to come back once progress is made. I suspect that I need to implement a function to handle this situation. Here is the snippet of my code:
<template>
<div id="app" v-show="show">
<vue-ellipse-progress :progress="progress" colorFill="#955251" :noData="nodata" :size="size" :thickness="10" />
</div>
</template>
<script>
export default {
name: 'app',
props: {
nodata: Boolean,
},
components: {},
data() {
return {
size: 100,
show: true,
progress: 50,
};
},
mounted() {
if(this.progress === 0) this.nodata = true
},
methods: {},
};
</script>
I have tried using conditions like
"if(this.progress === Number) this.nodata = false"
. While it worked with "if(this.progress === 1) this.nodata = false"
, the problem is that the progress bar needs to reach exactly 1 for the data to display again. If the progress jumps to something like 20 instantly, it still won't show any data.
I could manually set conditions for all increments (such as 1, 2, 3, etc.) but I believe there must be a simpler solution.
If anyone can offer some guidance, I would greatly appreciate it :)