为什么我的图像没有显示在模态中?
Why is my image not showing in the modal?
大家好,我正在尝试制作一个模态框,它会在单击按钮时显示图像。但是我 运行 遇到了一个问题,似乎不明白为什么我的图像没有显示在我的模态中。我正在使用 bootstrap 4.5.2 制作此模式。
当我在 src 中使用这个 url 时://placehold.it/600x400。该图像工作正常,但是当我 link 来自我名为 resources 的文件夹中的相同图像时,该图像不会加载。
这是我的代码
<!-- Button trigger modal -->
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#exampleModalCenter">
Launch demo modal
</button>
<!-- Modal -->
<div class="modal fade" id="exampleModalCenter" tabindex="-1" role="dialog" aria-labelledby="exampleModalCenterTitle" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLongTitle">Modal title</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body" id="dynamic-content">
<img src="Resources/600x400.png" alt="officeMap" class="img-fluid">
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
<button type="button" class="btn btn-primary">Save changes</button>
</div>
</div>
</div>
</div>
这是我的路径
将文件路径更改为 PlanPage/Resources/600x400.png 解决了问题。
大家好,我正在尝试制作一个模态框,它会在单击按钮时显示图像。但是我 运行 遇到了一个问题,似乎不明白为什么我的图像没有显示在我的模态中。我正在使用 bootstrap 4.5.2 制作此模式。
当我在 src 中使用这个 url 时://placehold.it/600x400。该图像工作正常,但是当我 link 来自我名为 resources 的文件夹中的相同图像时,该图像不会加载。
这是我的代码
<!-- Button trigger modal -->
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#exampleModalCenter">
Launch demo modal
</button>
<!-- Modal -->
<div class="modal fade" id="exampleModalCenter" tabindex="-1" role="dialog" aria-labelledby="exampleModalCenterTitle" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLongTitle">Modal title</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body" id="dynamic-content">
<img src="Resources/600x400.png" alt="officeMap" class="img-fluid">
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
<button type="button" class="btn btn-primary">Save changes</button>
</div>
</div>
</div>
</div>
这是我的路径
将文件路径更改为 PlanPage/Resources/600x400.png 解决了问题。