假设有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();
});
});
==============个人学习总结。
本文详细介绍了在HBuilder中利用自定义事件实现A页面跳转到B页面,并将B页面的数据回传给A页面的具体方法。通过使用plus.webview API和mui.fire函数,实现了页面间的数据交互。
4929

被折叠的 条评论
为什么被折叠?



