Search code examples
imagevue.jsparallaxvuetify.jssrc

vue.js vuetify: v-parallax doesn't work with local files?


Using v-parallax with an online image source like this works fine:

<v-parallax 
    dark 
    height="470" 
    src="https://images.unsplash.com/photo-1466916932233-c1b9c82e71c4?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1500&q=80">
</v-parallax>

But using it with a local asset src="@/assets/img/my-picture.png" doesn't work.

The same goes for <v-img src="my/local/source>, whereby <img> works fine.

What is the way to make it work?


Solution

  • Try this :src="require('@/assets/img/my-picture.png')"