增加切换主页面方法
This commit is contained in:
+40
-5
@@ -35,17 +35,17 @@
|
||||
<span class="mui-tab-label">首页</span>
|
||||
</a>
|
||||
|
||||
<a class="mui-tab-item" href="views/house/houseDetail.html">
|
||||
<a class="mui-tab-item" id="views/house/houseDetail.html" href="views/house/houseDetail.html">
|
||||
<span class="mui-icon iconfont icon-tab02"></span>
|
||||
<span class="mui-tab-label">行情</span>
|
||||
</a>
|
||||
|
||||
<a class="mui-tab-item" href="views/house/houseManageList.html">
|
||||
<a class="mui-tab-item" id="views/house/houseManageList.html" href="views/house/houseManageList.html">
|
||||
<span class="mui-icon iconfont icon-tab03"></span>
|
||||
<span class="mui-tab-label">评估</span>
|
||||
</a>
|
||||
|
||||
<a class="mui-tab-item" id="selfInfo" href="views/user/userInfo.html">
|
||||
<a class="mui-tab-item" id="views/user/userInfo.html" href="views/user/userInfo.html">
|
||||
<span class="mui-icon iconfont icon-tab04"></span>
|
||||
<span class="mui-tab-label">我的</span>
|
||||
</a>
|
||||
@@ -72,8 +72,6 @@
|
||||
localStorage.removeItem("user_token");
|
||||
localStorage.removeItem("user_token_add_time");
|
||||
}
|
||||
//document.getElementById("quotations").setAttribute("href", BASE_PATH + '/quotations/index');
|
||||
//document.getElementById("selfInfo").setAttribute("href", BASE_PATH + '/selfInfo/index');
|
||||
//mui初始化
|
||||
mui.init();
|
||||
var subpages = ['yfindex.html', 'views/house/houseDetail.html', 'views/house/houseManageList.html', 'views/user/userInfo.html'];
|
||||
@@ -217,6 +215,43 @@
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
// 推送消息跳转页面
|
||||
window.addEventListener('switchView',function(event){
|
||||
console.log(event.detail.name)
|
||||
plus.webview.show(plus.webview.getWebviewById("HBuilder"));
|
||||
var targetTab = event.detail.name;
|
||||
if (targetTab == activeTab) {
|
||||
return;
|
||||
}
|
||||
//若为iOS平台或非首次显示,则直接显示
|
||||
if(mui.os.ios||aniShow[targetTab]){
|
||||
if(plus.webview.getWebviewById(targetTab)==null){
|
||||
plus.webview.create(targetTab, targetTab, subpage_style)
|
||||
}
|
||||
plus.webview.show(targetTab);
|
||||
}else{
|
||||
//否则,使用fade-in动画,且保存变量
|
||||
var temp = {};
|
||||
temp[targetTab] = "true";
|
||||
mui.extend(aniShow,temp);
|
||||
plus.webview.show(targetTab,"fade-in",300);
|
||||
}
|
||||
//隐藏当前;
|
||||
plus.webview.hide(activeTab);
|
||||
//更改当前活跃的选项卡
|
||||
activeTab = targetTab;
|
||||
var defaultTab = document.getElementById(targetTab);
|
||||
//模拟首页点击
|
||||
mui.trigger(defaultTab, 'tap');
|
||||
//切换选项卡高亮
|
||||
var current = document.querySelector(".mui-bar-tab>.mui-tab-item.mui-active");
|
||||
if (defaultTab !== current) {
|
||||
current.classList.remove('mui-active');
|
||||
defaultTab.classList.add('mui-active');
|
||||
}
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user