Front-end splicing dynamic loading request to get the picture

 

Scenario:

       Passed to the back end of the front end of a picture name, front-end splicing get local Photo Gallery

Solution:

1. Configure the document build / webpack.base.conf.js

 

2, reference

rear end

Assembly references

<img :src="'./static/img/' + queryData.imagePath" :onerror="defaultImg" style="width:100%" />

put the picture data in an incorrect default display picture

defaultImg: ' this.src = "./ static / img / logo.png" '  // default project pictures

 Path after use

structure

 

Guess you like

Origin www.cnblogs.com/qdlhj/p/11127762.html