您的位置:首页 > 其它

页面操作全部采用调用函数方法实现(包括监听事件)

2017-09-13 16:51 363 查看
mui.plusReady(function() {

//改变statusbar
plus.navigator.setStatusBarBackground('#41cea9');
navtitle = document.getElementById('nav-title');
mainWebView = plus.webview.currentWebview();
//判断是否已经登陆,若没有登陆将预加载登陆页面,知道登陆成功为止close登陆页面
judgelogin();
//初始化商品详情页面。
initProductDetail();
//初始化页面,
inittabitemWebviews();
//为每个bar-item添加点击事件
addEventForTabitem();
//接收自定义的事件页面切换
changeWebViewEvent();

});


例如其中选项卡点击监听也用函数来实现

function addEventForTabitem() {
mui('.mui-bar-tab').on('tap', '.mui-tab-item', function() {
var tabitem = this;
if (tabitem == curTabItem) {
return;
}
curTabItem = tabitem;
navtitle.innerText = tabitem.children[tabitem.children.length - 1].innerText;
//设置将显示当前webview
showCurWebView(tabitem.getAttribute('href'));
});
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐