[Vuejs]-Vue img v-for bind

0👍

What you do in Vue is correct. The problem is with your image paths:
To use relative paths leave the ./ and just write assets/imgs/aa.PNG. (considering that <host>/assets is an accessible public folder; e.g. https://www.example.com/assets)

If you are trying to include your images in your bundle with webpack imports you have to use webpacks require function. Unfortunately webpack does not recognize regular relative paths. It would look like so:

 imgItems: [
   {
     thumbnail: require('./assets/imgs/as.png'),
     description: '1',
   },
   ...
 ]

Leave a comment