如何在 Angular 中停止 iframe console.log

问题描述

如何在 Angular 11 中停止 iframe console.log

我有

尝试了 1:

<iframe width="100%" height="100%" [src]="myurl" frameborder="0" allowfullscreen #chatRoom ng-onload="setChatRoom()"></iframe>

setChatRoom() {
    console.log = function() {console.log('no log')}
}

尝试了 2 个:

@ViewChild('chatRoom',{static: false}) chatRoom: ElementRef;
ngAfterViewInit() {
    this.chatRoom.nativeElement.el.console.log = function() {}
}

尝试了 3 个:

<iframe width="100%" height="100%" [src]="myurl" frameborder="0" allowfullscreen #chatRoom ng-onload="setChatRoom()"></iframe>

setChatRoom() {
        this.chatRoom.nativeElement.el.console.log = function() {}
}

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)