Exploring vue-cli and encountering a challenge.
I've created a row of 24 div elements with the following code:
<template>
<div class="row">
<div class="hour" v-on:click="colorize" v-for="n in 24"></div>
</div>
</template>
My goal is to change the background color of the clicked hour
div based on a value stored in VueX, but the key issue lies elsewhere.
Below are my methods :
methods: {
colorize() {
if(this.$store.state.picked === 1) {
this.style.backgroundColor="rgb(103, 103, 103)";
}
}
}
The store functions correctly, but I suspect there's an error in how I'm using the 'this' attribute.
Any suggestions? :)