angular - 部署网站后不显示图像的相对路径
问题描述
[ ][1]我存储在我的投资组合中的图像在本地提供时显示,但在网站部署后,它不显示。我正在使用最新版本的 Angular fyi 以下是我正在使用的代码片段。这是我电脑上的图像,我存储在位于资产下的图像文件夹中。
<img alt="Kristopher Lea" src="../assets/images/KristopherLea2.jpg">
<h3 class="city">Hometown:
{{city}}
</h3>
解决方案
图像 src 应如下所示:
<img alt="Kristopher Lea" src="assets/images/KristopherLea2.jpg">
或者:
<img alt="Kristopher Lea" src="/assets/images/KristopherLea2.jpg">
推荐阅读
- facebook - 如何从 Facebook 嵌入式帖子中隐藏喜欢、分享、评论按钮?
- angular - Angular 7 ngrx 编辑商店没有特定操作
- c++ - 从输入流中读取 std::array
- javascript - 如何重新排列对象的属性?
- javascript - ZeroMQ - 错误:模块版本不匹配。预期 46,得到 67
- javascript - 通过 PHP/JS 加载 HTML 时 JavaScript 函数不起作用
- bluetooth-lowenergy - 多个同时连接的链路层状态
- java - 等到所有线程都在等待第一次通知之前
- c# - 串口字节转 ASCII
- c# - string.Format 将字符串粘贴为不带引号的参数