Struggling to connect the opacity of a div
with the value of a slider
.
<div class="container" v-bind:style="opacity">test content</div>
Despite my efforts, I can't seem to make the binding work correctly. When I check in the developer tools, I see that the div
is being bound to the object instead of the style itself.
My watcher function looks like this:
watch:{
opacity: function(oldValue, newValue) {
console.log(this.opacity);
return {
'"style"':this.opacity
}
},
},...
The console shows the correct opacity values ranging from 0-1. They appear like this: https://i.sstatic.net/5Tvgw.png
I'm puzzled by what's going wrong with the inline binding. Any assistance would be highly appreciated!