先来看一段代码

(function(m, doc) {
    mui.plusReady(function(){
      var self = plus.webview.currentWebview();
      oltid = self.oltid;
      oltmac = self.oltmac;
      mui.init({
         subpages:[{
           url:'sub_onu_list.html',
           id:'sub_onu',
           styles:{
               top: '40px',
               bottom: '0px',
           },
           extras:{  
              oltid : oltid,  
              oltmac : oltmac  
            }  
         }]
     });
  });
}(mui, document));

不知道你们有没有看的很奇怪,mui.init 与mui.plusReady  都是并列同级写的,这里mui.init 竟然在 mui.plusReady  里面,,,

是因为我需要把从上个页面接收到的值传到下个页面去。。

mui.plusReady 里面存的   oltid = self.oltid;   oltmac = self.oltmac;     在外面根本取不到值,,所以我要用到这两个值的话就直接放在 mui.plusReady 里面使用了。

我这边是需要传值到下一个页面。

还有一种传值的方法 :

 //创建子webview
    var child = plus.webview.create("refresh_topics.html", //这里是下一个页面。。网上找的,这里也不知道是url还是名字
            "refresh_topics", //这个没看懂。
            {top:"46px",bottom:"0"}, //这个是子页面的body样式
            {"topic_id":topic_id});//这里是传的值和字段 cur.append(child);

这种方法没试过。。第一种亲试有效。2018 .5.03。 

 

相关文章:

  • 2021-09-05
  • 2021-08-09
  • 2021-12-14
  • 2021-12-20
  • 2021-11-11
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-06-26
  • 2022-02-22
  • 2022-01-13
  • 2021-08-19
  • 2022-12-23
相关资源
相似解决方案