document.getElementById('sx').addEventListener('tap',function(){mui.openWindow({
url:'buycarsx.html',
id:'sx'
});
});
});
3、绑定事件完成页面跳转(取消绑定用off也写在mui.plusReady(function(){}))
mui.plusReady(function(){
mui('body').on('tap', '.offer_box > li', function() {
mui.openWindow({
url:'cardetails.html',
id:'cardetails.html'
});
});
});
手势事件
点击 (单击tap 双击 doubletap)
长按(longtap 长按屏幕 hold 按住屏幕 release 离开屏幕)
滑动(swipeleft 向左滑动 swiperight 向右滑动 swipeup向上滑动 swipedown 向下滑动)
拖动(dragstart 开始拖动 drag 拖动中 dragend 拖动结束)
页面传值(自定义事件)
mui.plusReady(function(){//父页面
//预加载
var prPage =mui.preload({url :"cardclcs.html",id :"cardclcs.html"});
//页面传值跳转
mui('body').on('tap','.mui-media-body', function(){mui.fire(prPage,'news',{'cz':this.innerHTML});//news 和cz都是随意自己定的主要是和传给值的对象那里用的
// mui.fire(prPage,'news',{'id':this.getAttrubute('id')});//news 和id都是随意自己定的主要是和传给值的对象那里用的 第二个id是页面自己的id
mui.openWindow({url :"cardclcs.html",id :"cardclcs.html"})
});
})
//子页面接值
mui.plusReady(function(){window.addEventListener('news',function(e){//news是cardetails.html页面自己随意定的
var mmq =mui('#mmq');
mmq[0].innerHTML = e.detail.cz;//cz是cardetails.html页面自己随意定的
//mmq[0].innerHTML = e.detail.id;//id是cardetails.html页面自己随意定的
});
})
app与服务器之间的交互共四个方法mui.ajax({})
mui.post() 里面不用写url type datatyp data 等可直接把其后的值直接写在里面
mui.get()里面不用写url type datatyp data 等可直接把其后的值直接写在里面
mui.getJSON()里面不用写url type datatyp data 等可直接把其后的值直接写在里面