您的位置:首页 > 其它

监听列表点击事件(打开新页面并实现页面传值)

2017-09-13 13:14 501 查看
父页:

<ul id="carNoList" class="mui-table-view"style="position:absolute;left:0px;top:80px;right:0px;">

</ul>
carNoList = document.getElementById('carNoList');

//监听车号列表点击事件
//function choiceCarNo(){
mui("#carNoList").on('tap', 'li', function(){
var carnochoosed = this.innerHTML.substring(4,11);
mui.openWindow({
id: "carNoDetail",
url: "carNoDetail.html",
styles: {
top: '0px',
bottom: '0px',
left: '0px',
bounce: 'vertical',
bounceBackground: '#f8f8f8'
},
extras : {'carnochoosed':carnochoosed},
waiting: {
autoShow: false
//								title:'正在加载...',//等待对话框上显示的提示内容
//    							options:{
//      						width:waiting-dialog-widht,//等待框背景区域宽度,默认根据内容自动计算合适宽度
//      						height:waiting-dialog-height,//等待框背景区域高度,默认根据内容自动计算合适高度
}
});

});

子页:

window.onload = function(){
needToinput= document.querySelector('.needToinput');
operateButton= document.querySelector('.operateButton');
carNoChoosed = document.getElementById('carNoChoosed');
carDetailList = document.getElementById('carDetailList');
// car_no = plus.webview.currentWebview().carnochoosed;//页面传值
// document.getElementById("carNoChoosed").innerHTML = car_no;
// getlist();
mui.plusReady(function() {
// needToinput= document.querySelector('.needToinput');
// operateButton= document.querySelector('.operateButton');
// needToinput.style.display = 'none';
// operateButton.style.display = 'none';
// carDetailList = document.getElementById('carDetailList');
// car_no = plus.webview.currentWebview().carnochoosed;//页面传值
//
car_no = plus.webview.currentWebview().carnochoosed;//页面传值
carNoChoosed.innerHTML = car_no;
getlist();
//关闭等待框
plus.nativeUI.closeWaiting();
//显示当前页面
mui.currentWebview.show();
//获取原始窗口的高度
var originalHeight=document.documentElement.clientHeight || document.body.clientHeight;
//console.info("原始窗口的高度"+originalHeight);
window.onresize=function(){
//软键盘弹起与隐藏 都会引起窗口的高度发生变化
var resizeHeight=document.documentElement.clientHeight || document.body.clientHeight;
//console.info("软键盘弹起后窗口的高度"+resizeHeight);
if(resizeHeight*1<originalHeight*1){ //resizeHeight<originalHeight证明窗口被挤压了
plus.webview.currentWebview().setStyle({
height:originalHeight
});
}
}
});
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: