I am currently working on a vue.js component that includes a div.icon
:
Vue.component('obj', {
props: ['img', 'name'],
template: '<div><div class="icon"></div> {{ name }}</div>'
})
While it is simple to use {{ name }}
, I am struggling with how to pass the {{ img }}
.
I attempted to add the following code, but it was not successful:
v-bind:style="{ backgroundImage: 'url(' + {{ img }} + ')' }"
Can someone please guide me on how to utilize the prop img
to set a background-image?