对于img标签路径加载失败是的处理(onerror事件)
<img *ngIf="showLogo" [src]="logoUrl" alt="logo" class="logo" (error)="imgerror($event)">
<img src="http://localhost:49610/Content/Images/logo_mobile.png" alt="" onerror="imgerror(this)"/>
imgerror(e
) {
this.showLogo
= false;
console
.log("找不到图片");
e
.onerror
= null;
}
转载请注明原文地址: https://yun.8miu.com/read-18468.html