主页面消息推送切换页面逻辑优化
This commit is contained in:
+5
-13
@@ -30,7 +30,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<nav class="mui-bar mui-bar-tab">
|
||||
<a class="mui-tab-item mui-active" id="defaultTab" href="yfindex.html">
|
||||
<a class="mui-tab-item mui-active" id="yfindex.html" href="yfindex.html">
|
||||
<span class="mui-icon iconfont icon-tab01"></span>
|
||||
<span class="mui-tab-label">首页</span>
|
||||
</a>
|
||||
@@ -132,8 +132,10 @@
|
||||
var title = document.getElementById("title");
|
||||
//选项卡点击事件
|
||||
mui('.mui-bar-tab').on('tap', 'a', function(e) {
|
||||
plus.nativeUI.showWaiting();
|
||||
var targetTab = this.getAttribute('href');
|
||||
if (targetTab == activeTab) {
|
||||
plus.nativeUI.closeWaiting();
|
||||
return;
|
||||
}
|
||||
//更换标题
|
||||
@@ -156,18 +158,7 @@
|
||||
plus.webview.hide(activeTab);
|
||||
//更改当前活跃的选项卡
|
||||
activeTab = targetTab;
|
||||
});
|
||||
//自定义事件,模拟点击“首页选项卡”
|
||||
document.addEventListener('gohome', function() {
|
||||
var defaultTab = document.getElementById("defaultTab");
|
||||
//模拟首页点击
|
||||
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');
|
||||
}
|
||||
plus.nativeUI.closeWaiting();
|
||||
});
|
||||
|
||||
// 加载启动页信息
|
||||
@@ -223,6 +214,7 @@
|
||||
plus.webview.show(plus.webview.getWebviewById("HBuilder"));
|
||||
var targetTab = event.detail.name;
|
||||
if (targetTab == activeTab) {
|
||||
plus.webview.show(targetTab);
|
||||
return;
|
||||
}
|
||||
//若为iOS平台或非首次显示,则直接显示
|
||||
|
||||
Reference in New Issue
Block a user