然后它也应该以圆形显示.但它显示为正方形,如下图所示
我认为你可能想要回退到其他图像或其他占位符.你可以像这样实现它:
<img src="https://material.angul.io/assets/img/examples/shiba2.jpg"
class="company"
onerror="this.src='https://via.placeholder.com/70x70'">
Run Code Online (Sandbox Code Playgroud)
请注意onerror
.您可以附加处理函数来执行更复杂的操作,例如隐藏img
元素和显示其他占位符元素.