监听点击物理返回键及mui.fire父子页面传参

子页面:

 1 plus.key.addEventListener('backbutton', function() {
 2         console.log("监听到物理返回按键了plusResdy");
 3         var selfPage = plus.webview.currentWebview();
 4         var openerPage = selfPage.opener();
 5         mui.fire(openerPage,'nameFun',{
 6             strUncertaintyLevelCopy:localStorage.getItem("strUncertaintyLevelCopy"),
 7             strMetricsCopy:localStorage.getItem("strMetricsCopy"),
 8             strMeasRangeCopy:localStorage.getItem("strMeasRangeCopy"),
 9             manufacturerCopy:localStorage.getItem("manufacturerCopy")
10         });
11         mui.back();
12     }, false);

父页面接收子页面传的参数:

1 window.addEventListener('nameFun',function(event){
2     //通过event.detail可获得传递过来的参数内容....
3     strUncertaintyLevelPaste = event.detail.strUncertaintyLevelCopy;
4     strMetricsPaste = event.detail.strMetricsCopy;
5     strMeasRangePaste =event.detail. strMeasRangeCopy;
6     manufacturerPaste =event.detail. manufacturerCopy;
7 //  console.log("计量特性复制值1:"+strUncertaintyLevelPaste+";规格型号复制值1:"+strMetricsPaste+";测量范围复制值1:"+strMeasRangePaste+";生产厂家复制值1:"+manufacturerPaste)
8 });

 

posted @ 2019-07-23 17:01  微光半夏星  阅读(254)  评论(0编辑  收藏  举报