The bizarre picture loading problem of vue-cli

the backend returns the image address, and after stitching the string, it is displayed on the page

The actual address displayed by the src of

img is http://localhost:port/+ picture address

which god knows how to solve this problem


img src

img src

Feb.27,2021

if there is a problem with localhost:port, you can just change ${API_IMGURL} to the server static resource directory


I don't quite understand your question

host = http://localhost:8000
${API_IMGURL} change to ${host} ${API_IMGURL}

won't it be all right?

This problem does not occur with

. What's in front of the string you spliced? Shouldn't it be an absolute path?

Menu