Table of contents
Problem Description
Import method
<image src="/static/user.png"></image>
Since the url uses a secondary directory,http://www.demo.com/mini/
There is no problem in the development environment, resources can be requested normally
After going online, it is found that the path of the static resource request is
http://www.demo.com/static/user.png
The resource cannot be requested, and a 404 is returned
solution
There are many ways on the Internet
<image src="../../static/user.png"></image>
<image src="@/static/user.png"></image>
can't get
<image :src="userImage"></image>
<script>
const userImage = require("../../static/user.png)
</script>
In fact, the final solution is also very simple, using the method relative to the current directory
<image src="static/user.png"></image>
That is to remove the front path /
, and get the correct path after going online
http://www.demo.com/mini/static/user.png