我刚接触Angular,最近将一个示例网页部署到Github Pages上。虽然成功部署,但在本地主机上可见的图片却未能显示出来,而是在控制台中记录了404错误。
这个组件包含以下img
标签:
home.component.html :
<div>
<img src='assets/images/birthday.jpg' alt='Happy Birthday' width="385px"/>
</div>
我的目录结构如下:
|src
|--app
|--assets
|---images
|----birthday.jpg
< p > dist
文件夹中的目录结构如下:
|dist
|--happy-birthday
|--assets
|---images
|----birthday.jpg
我正在使用angular-cli-ghpages
包进行部署。我的Angular版本是10.0.14
。