关于获取webview(窗口间关系)的方法

1.获取指定页面ID的webview

  plus.webview.getWebviewById('为页面设置的id值');

  该方法主要用于首页底部导航切换到子页面时不执行子页面的函数,因为在设置导航的时候我们设置了页面ID,所以可以用这种方法获取子页面,再通过mui.fire()进行自定义事件;

2.获取当前页面的webview

  plus.webview.currentWebview()

  var ws=plus.webview.currentWebview();//获取当前页面所属的Webview窗口对象

  console.log( "窗口标识: "+ws.id );

  console.log( "当前Webview窗口:"+ws.getURL() );

3.获取当前页面的父级

  plus.webview.currentWebview().opener();

4.获取所有的可视的webview窗口

  plus.webview.all();

5.获取应用显示栈顶的WebviewObject窗口对象

  plus.webview.getTopWebview();

6.界面重新加载

  location.reload()

引用 https://blog.csdn.net/qq_27626333/article/details/51811746

原文地址:https://www.cnblogs.com/duanzb/p/9560527.html