javascript - Vue.js data-bind style backgroundImage not working -
i'm trying bind src of image in element, doesn't seem work. i'm getting "invalid expression. generated function body: { backgroundimage:{ url(image) }".
the documentation says use either 'kebab-case' or 'camel-case'.
<div class="circular" v-bind:style="{ backgroundimage: { url(image) }"></div>
heres fiddle: https://jsfiddle.net/0dw9923f/2/
the issue value backgroundimage needs string this:
<div class="circular" v-bind:style="{ backgroundimage: 'url(' + image + ')' }"></div> here's simplified fiddle that's working: https://jsfiddle.net/89af0se9/1/
re: comment below kebab-case, how can that:
<div class="circular" v-bind:style="{ 'background-image': 'url(' + image + ')' }"></div> in other words, value v-bind:style plain javascript object , follows same rules.
Comments
Post a Comment