1、webview页面前关闭提示
//重写后退按纽
mui.back = function() {
mui.confirm('真的要走吗?', '警示', ['确定', '取消'], function(e) {
if(e.index == 0) {
var self = plus.webview.currentWebview();
//plus.webview.close(self);//方法一
self.close();//方法二
} else {
mui.toast('谢谢留下!');
}
});
}
2、监听页面加载或显示
加载
var ws = plus.webview.getWebviewById(id)
ws.addEventListener( "loaded", function(e){
console.log( "Loaded: "+e.target.getURL() );
}, false );
显示
var ws=plus.webview.currentWebview();
ws.addEventListener("show", function(e){
console.log( "Webview Showed" );
}
原文链接:
https://www.cnblogs.com/beast-king/p/9119125.html
https://www.cnblogs.com/beast-king/p/9113890.html