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.
vue-cli 中 img 的 src 无法引入问题
First and foremost,putting your image‘s files in the public directory
vue-cli 中 img 的 src 无法引入问题
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`">

相关文章:

  • 2021-12-08
  • 2022-12-23
  • 2022-12-23
  • 2021-11-26
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-07-06
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-10-12
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案