Skip to content

Commit

Permalink
增加判断iframe内容是否提供Reconnect方法,有提供的话,直接调用Reconnect,而不是刷新整个页面
Browse files Browse the repository at this point in the history
  • Loading branch information
zhwq1216 authored and BaiJiangJie committed Sep 6, 2022
1 parent a473ac7 commit 3773395
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/app/elements/iframe/iframe.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ export class ElementIframeComponent implements OnInit, AfterViewInit, OnDestroy
case 'CLOSE':
this.view.connected = false;
break;
case 'CONNECTED':
this.view.connected = true;
break;
case 'CLICK':
document.body.click();
break;
Expand Down Expand Up @@ -86,6 +89,12 @@ export class ElementIframeComponent implements OnInit, AfterViewInit, OnDestroy
}

reconnect() {
// @ts-ignore
if (typeof (this.iframeWindow.Reconnect) === 'function') {
// @ts-ignore
this.iframeWindow.Reconnect();
return;
}
const url = this.src;
this.src = 'about:blank';
setTimeout(() => {
Expand Down

0 comments on commit 3773395

Please sign in to comment.