获取当前页面的webview ID

代码:
A页面
<script type="text/javascript">
var ws = null;
mui.plusReady(function(){
ws = plus.webview.currentWebview();
ws.id = 'index';
// console.log(ws.id);
});
mui("body").on("tap", "a", function() {
var id = this.href;
mui.openWindow({
id: id,
url: id,
styles: 'webview_style',
extras:{
pageId:ws.id //扩展参数
},
show: {
aniShow: 'pop-in'
}
});
});
</script>
B页面
<script type="text/javascript">
mui.plusReady(function(){
var ws = plus.webview.currentWebview();
var page = plus.webview.getWebviewById(ws.pageId);
console.log(page);
});
</script>
打出log后page为null 

原文

猜你喜欢

转载自www.cnblogs.com/xiaoshen666/p/10748153.html