培培弟
培培弟
  • 发布:2018-08-23 17:45
  • 更新:2018-08-27 18:02
  • 阅读:2057

mui其它页面跳转主页Tab选项,真机测试没问题,一打包就不能跳转到对应Tab

分类:MUI

真机调试能正常跳转,打包出来就不能正常跳转

2018-08-23 17:45 负责人:无 分享
已邀请:
5***@qq.com

5***@qq.com - 90后web前端

目前通过另一种换页方式,暂时解决.可以借鉴.

mui.plusReady(function() {  
                //设置默认打开首页显示的子页序号  
                var Index = 0;  
                //把子页面路径写在数组里面  
                var subpages = ['home.html', 'classify.html', 'serviceCenter.html', 'shopCart.html', 'mine.html']  
                //获取当前页面所属的Webview窗口对象  
                var self = plus.webview.currentWebview();  
                for(var i = 0; i < 5; i++) {  
                    //创建webview子页  
                    var sub = plus.webview.create(  
                        subpages[i], //子页url  
                        subpages[i], //子页id  
                        {  
                            top: '0px',  
                            bottom: '44px',  
                            scrollIndicator: "none" //隐藏滚动条  
                        }  
                    );  
                    //如果不是我们设置的子页就隐藏  
                    if(i != Index) {  
                        sub.hide()  
                    }  
                    //将webview对象填充到窗口  
                    self.append(sub)  
                }  

                //当前激活选项  
                var activeTab = subpages[Index]  
                var targetTab;  
                mui('#footList').on('tap', 'a', function(e) {  
                    //获取子页面的id  
                    var j = this.getAttribute('data-id')  
                    h(this).parent().addClass("footActive");  
                    h(this).parent().siblings().removeClass("footActive");  
                    targetTab = subpages[j]  
                    if(activeTab == targetTab) {  
                        return  
                    }  
                    //显示目标选项卡  
                    plus.webview.show(targetTab)  
                    //隐藏当前选项卡  
                    plus.webview.hide(activeTab)  
                    //更改当前活跃选项卡  
                    activeTab = targetTab  
                })  
            })
5***@qq.com

5***@qq.com - 90后web前端

我也遇到这个问题了,同问

该问题目前已经被锁定, 无法添加新回复