mui.openWindow兼容web&plus环境页面传参背景介绍刚准备写一个微信项目公众号和html5+兼容的项目发现一直用localStorage是没有问题的传参数啊,太不优雅了。想了想,还是想办法兼容吧。兼容性原则在调用mui.openWindow前,先判断相关环境,执行相关的兼容性方法。使用场景需要兼容网页&html5+项目。项目需要引入mui.js打开pages/webview导入mui.openWindow.js文件就是mui.openWindow的使用方法,正常写传参代码mui.openWindow({url:'target.html',id:'target',extras:{name:'mui'}});接收参数页面//同步调用if(mui.os.plus){mui.plusReady(function(){varextras=mui.getExtras();console.log(extras);});}else{varextras=mui.getExtras();console.log(extras);}//异步调用mui.getExtras(function(extras){console.log(extras);});上传源码到github(觉得还好记得给我star)点我在线预览(记得给我star)
