【发布时间】:2023-03-28 18:56:01
【问题描述】:
我正在尝试根据条件对两个图像源使用角度三元运算符。我没有收到任何错误,但图像没有显示。
<img
class="rounded-circle z-depth-2 mb-2"
width="100"
height="100"
alt="profile picture"
[attr.src]="user.user_profile_picture !== null ? 'http://localhost:8000/storage/profile_images/' +
user.user_profile_picture.image : 'http://localhost:8000/storage/profile-picture.png'"
data-holder-rendered="true"
/>
</div>
我在这里犯了一个基本错误吗?
【问题讨论】:
-
只使用
[src],而不是[attr.src],它应该可以正常工作