Vue v-for renders local static images

I recently encountered a problem with a small project. Using v-for to render local static images cannot be displayed. I put the images under the assets file

Then put it in the data of a certain page,

 

 I'm going to use v-for to render a set of pictures but it can't be displayed. What's the matter?

I found it online

  

It turns out that webpack will treat the images under src/assets as module dependencies for processing

So what's the solution?

1. Use require to introduce the image path, for example require('./relative/path/to/file.jpg')

2. Put the picture under the static folder 

Then there is a question at this time, why can it be placed in a static file?

  

 It turns out that files under static will not be processed by webpack

(The above information is found at https://www.cnblogs.com/minigrasshopper/p/8011630.html )

 

Guess you like

Origin blog.csdn.net/A_D_H_E_R_E/article/details/120016773