I am currently working on a website where each category has its own color scheme applied to the anchor elements within it.
Although I know I can use style binding like this:
:style="{ color: theColor }"
Manually attaching this to every link element seems inefficient and counterintuitive.
At the moment, I retrieve the color from the store using computed properties.
<script>
computed: {
theColor() {
return this.$store.state.theColor;
}
}
</script>
The color itself is in hexadecimal format and can be changed via the backend on Netlify. Hardcoding separate classes is not a viable solution.
My instinct tells me to iterate through all anchor elements and assign them the color from the store. But how would I go about doing this in Vue?