vue-cli 中 img 的 src 无法引入问题
An error is reported as shown in the figure.
After consulting official documents, it turned out that there was no webpack problem, but another way was found.
First and foremost,putting your image‘s files in the public directory
In addition, you will need to first pass the base URL to your component in templates:
data () {
return {
baseUrl: process.env.BASE_URL
}
}
Then:
<img :src="`${baseUrl}my-image.png`">