YOUFANG1.0.4 页面切换
This commit is contained in:
+9
-28
@@ -216,42 +216,23 @@
|
|||||||
|
|
||||||
// 推送消息跳转页面
|
// 推送消息跳转页面
|
||||||
window.addEventListener('switchView',function(event){
|
window.addEventListener('switchView',function(event){
|
||||||
var self = plus.webview.currentWebview();
|
console.log(event.detail.name);
|
||||||
console.log(event.detail.name)
|
if(plus.webview.getWebviewById('H5693FF3D')==null){
|
||||||
plus.webview.show(plus.webview.getWebviewById("HBuilder"));
|
plus.webview.show(plus.webview.getWebviewById("HBuilder"));
|
||||||
var targetTab = event.detail.name;
|
}else{
|
||||||
if (targetTab == activeTab) {
|
plus.webview.show(plus.webview.getWebviewById("H5693FF3D"));
|
||||||
|
}
|
||||||
|
var targetTab = event.detail.name;
|
||||||
|
if (targetTab == activeTab) {
|
||||||
plus.webview.show(targetTab);
|
plus.webview.show(targetTab);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
//若为iOS平台或非首次显示,则直接显示
|
|
||||||
if(mui.os.ios||aniShow[targetTab]){
|
|
||||||
if(plus.webview.getWebviewById(targetTab)==null){
|
|
||||||
var sub = plus.webview.create(targetTab, targetTab, subpage_style)
|
|
||||||
self.append(sub);
|
|
||||||
}
|
|
||||||
plus.webview.show(targetTab);
|
|
||||||
}else{
|
|
||||||
//否则,使用fade-in动画,且保存变量
|
|
||||||
var temp = {};
|
|
||||||
if(plus.webview.getWebviewById(targetTab)==null){
|
|
||||||
targetTab = plus.webview.create(targetTab, targetTab, subpage_style)
|
|
||||||
}
|
|
||||||
self.append(targetTab);
|
|
||||||
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);
|
var defaultTab = document.getElementById(targetTab);
|
||||||
//模拟首页点击
|
//模拟首页点击
|
||||||
mui.trigger(defaultTab, 'tap');
|
mui.trigger(defaultTab, 'tap');
|
||||||
//切换选项卡高亮
|
//切换选项卡高亮
|
||||||
var current = document.querySelector(".mui-bar-tab>.mui-tab-item.mui-active");
|
var current = document.querySelector(".mui-bar-tab>.mui-tab-item.mui-active");
|
||||||
if (defaultTab !== current) {
|
if (defaultTab != current) {
|
||||||
current.classList.remove('mui-active');
|
current.classList.remove('mui-active');
|
||||||
defaultTab.classList.add('mui-active');
|
defaultTab.classList.add('mui-active');
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user