使用<img>Ember-cli中的src

Using <img> src in Ember cli

本文关键字:中的 src Ember-cli img lt 使用 gt      更新时间:2023-09-26

我无法使用Ember CLI显示图像。我尝试使用HTML <img>标记,并在我的环境文件中做了一个异常:

contentSecurityPolicy: {
  'img-src': "'self' * all"
}

我使用了这个<img>标签:

<img src="/public/images/image.png">

我收到以下错误消息:

Failed to load resource: the server responded with a status of 404 (Not Found)

我做错了什么?

指定路径时不要包含public目录。

相反,只需尝试以下操作:

<img src="images/image.png">

<img src="assets/public/images/image.png">

请将您的图像保存在上面的路径中,并在img标签的公共文件夹中提供此路径,该文件夹包含您的图像路径目录。