Search code examples
v-forquasar

quasar q-carousel with v-for


i try to use a v-for with a carousel for display many image with a loop and i have the following error: Error in render: "Error: Cannot find module '../statics/image.jpeg'"

  <q-carousel-slide
  v-for="(image) in images"
  :key="image.id"
  :name="image.id"
  :img-src="require(image.url)"
  />
  <script>
  ...
  images: [
    {
      id: 1,
      url: '../image/1.jpeg'

    }
]
  ...
  </script>

did someone have some solution?


Solution

  • in pass i've had the same problem, look at https://forum.quasar-framework.org/topic/6430/q-carousel-with-v-for/3?_=1601046738106 you need to add require in your data like this :

    url: require(‘src/assets/image.jpeg’)