Background image

I'm trying to use a slice image as a background image, in dev mode it works great but when built it all looks good technically but the image is not rendered...

<div class="my-class" :style="{ backgroundImage: 'url(' + slice.primary.mainimage.url + ')' }" />

Is there a way to make this work?

Hey Thomas, welcome to the Prismic community.

That line of code should render just fine with Vue or Nuxt.js. Are you getting any particular error in the console?

Thank you!
Oh it renders alright, codewise, and in the devtools i can see the url and even the preview of the image but in the browser there is no image showing. It's like Nuxt/Vue has gone for the day, there is no error in the console and everything else is working just fine.

Ah! :scream:
Something else is messing with my css styling. The image is there and showing. The containing div however is 0x0 in size...

Thank you!

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.