webview的hide事件无法触发
ios和安卓模拟器上可正常触发hide事件,安卓真机上测试不触发
var ww;
if(z_index ==2)
{
if(localStorage.getItem("webview-new2") == "")
{
console.log("3级页面");
localStorage.setItem("webview-new2",url);
ww = plus.webview.create(url,url);
}else{
ww = plus.webview.getWebviewById(localStorage.getItem("webview-new2"));
ww.loadURL(url);
}
ww = ww || plus.webview.getWebviewById(localStorage.getItem("webview-new2"));
}else{
console.log("2级页面");
if(localStorage.getItem("webview-new") == "")
{
localStorage.setItem("webview-new",url);
ww = plus.webview.create(url,url);
}else{
ww = plus.webview.getWebviewById(localStorage.getItem("webview-new"));
ww.loadURL(url);
}
ww = ww || plus.webview.getWebviewById(localStorage.getItem("webview-new"));
}
var bar = [
plus.navigator.getStatusBarBackground(),
plus.navigator.getStatusBarStyle()
];
ww.setStyle({backButtonAutoControl:"none",popGesture:"hide",top: top ? top : "0px"});
setTimeout(function(){ww.show("pop-in",300);}, 100);
ww.addEventListener('hide', function(e){
//安卓4的版本有bug,不触发hide事件,改到back函数里变通执行
plus.navigator.setStatusBarBackground(bar[0]);
plus.navigator.setStatusBarStyle(bar[1]);
var ss = plus.webview.currentWebview();
if(ss.id === 'gerenzhongxin.html' || ss.id === 'Mymoney.html')
{
ss.reload();
}
}, false);
0 个回复