When developing small programs with mpvue, static local pictures should be added
<img src="../../images/bg.png" alt="">
Will report an error:
VM14878:2 Failed to load local image resource /images/bg.png
the server responded with a status of 404 (HTTP/1.1 404 Not Found)
There are many reasons, the solution can be changed to webpack, or mpvue package, here provides a very direct way:
直接写 /static/img/xx.png
比如:
<img src="/static/img/bg.png" >
就可以了
The reason is also very simple. The mpvue has been packaged under the dist file and a static file has been generated. There is an img file under the static file to store the packaged picture. You can use the packaged picture directly!