假设有A 与 B 俩个页面,如果我想通过连接在a页面进入b页面,然后把b页面的值传递给a页面。下面是我的做法:
A页面代码:
=======================================================================================
var self = plus.webview.currentWebview();
document.addEventListener("shuju", function(e) {
address = e.detail.id;
});//相当于b页面返回时自定义了事件,a页面调用
B页面代码
===========================================================================================
document.getElementById("ensure").addEventListener("tap", function() { //点击按钮返回A页面
var detailPage;
if(!detailPage) {
detailPage = plus.webview.getWebviewById('signin.html');
}
mui.fire(detailPage, 'shuju', {
id: title,
lngs: lng,
lats: lat,
addresss: address
});
mui.back();
});
});
==============个人学习总结。