I want to change the value of a boolean after some time and keep repeating the process. Then I want to pass the value to a child component individually. Here changeActive() is the function to change the value of the active boolean. I want to change the value to the first prop then after some time second prop and so on.
<template>
<div style="width:300px; margin: auto;">
<RatingLabel
:rating='rating[0]'
:active='active'
style="margin: auto;"
/>
<RatingLabel
:rating='rating[1]'
:active='active'
style="float: right;"
/>
<RatingLabel
:rating='rating[2]'
:active='active'
/>
<RatingLabel
:rating='rating[3]'
:active='active'
style="margin: auto;"
/>
</div>
</template>
<script>
import RatingLabel from '../atomic/RatingLabel'
import { mapState } from 'vuex'
export default {
components: {
RatingLabel,
},
data() {
return {
active: false,
}
},
methods: {
changeActive() {
setTimeout(function(){
this.active = !this.active;
console.log(this.active)
}, 3000);
}
},
mounted() {
this.changeActive()
},
computed: mapState(['rating'])
}
</script>