I have several divs that I want to style with backgrounds from values stored in an array. My attempt to set the background overlay for each one by creating a computed property has not been successful:
computed: {
backgroundImage(url) {
let overlay = 'linear-gradient(270deg, rgba(0, 0, 0, .5), rgba(0, 0, 0, .5))';
return 'background-image:'+ overlay +' , url(' + url + ');';
}
}
I tried passing the URL like this to the computed property:
:style="{ backgroundImage: url(`${articles[0].image.src}`) }"
However, this approach is not returning the computed value as expected. How can I resolve this issue?