段二娃
段二娃
  • 发布:2014-11-22 19:48
  • 更新:2016-02-17 16:07
  • 阅读:5880

点击同样的一个button打开页面,Android能正常打开,iOS点击无反应

分类:HTML5+

RT,没有报错,而且在iOS系统中,刚进程序点击button没有反应,然后同步一下这个文件之后又正常了,但是重启一下APP还是点击button没有反应。

注:这个button以前是正常的,后来把tab bar改为webview模式之后就这样了

整个代码流程是这样的:

首先有个button:

<button class="mui-btn-yellow" id="login">登录</button>

然后给它注册一个监听事件:

document.getElementById('login').addEventListener('tap', function() {  
    console.log("tap on tabSelf input box !");  
        kj.shop.openWithLoading("login.html", "login");            
});

最后是这个openWithLoading方法:

this.openWithLoading = function(url, id, extra, preFunc) {  
            var newView = plus.webview.create(url, id, null, extra);  
            newView.addEventListener("loaded", function() {  
            preFunc && preFunc(newView);  
            newView.show("slide-in-right",100);  
            }, false);  
};
2014-11-22 19:48 1 条评论 负责人:无 分享
已邀请:
DCloud_UNI_FXY

DCloud_UNI_FXY

把console.log换成alert。然后在ios里边测试一下。看看有弹出没。确认一下是事件没触发,还是事件触发了。但是窗口没打开

  • 段二娃 (作者)

    测试过了,我在addEventListener加入mui.alert("1");,在openWithLoading中加入mui.alert("2");,点击这个button无效的时候,只弹出1;随便在这个button所在的HTML文件里面打个空格,然后同步一下这个文件,点击这个button又有效了,这时先弹出2,再弹出1;重启一下APP,点击这个button又无效了,点击只弹出1。以前tab bar是div模式的时候没有这个问题,后来改为webview模式才这样的,而且Android正常,只有iOS才这样,包括手机和iPad,iOS8.1和iOS7都会出现这个问题。

    2014-11-22 20:31

  • DCloud_UNI_FXY

    把你的工程发出来我看看

    2014-11-23 11:03

  • 转身遇见你

    这个问题解决了么??我也遇到了这样的问题,

    2015-09-11 15:00

leah_huang

leah_huang

问题解决了么 我也碰到类似问题,求解答

M522828

M522828

有没有引入mui.min.js文件

avst

avst

这个问题解决了吗。我这个有时能点开有时点不开

var getLiveList = function(username){  
            mui.ajax('http://avst.tv/avstAPP/web/index.php?s=Index/getLiveList',{  
                data:{  
                    username:username  
                },  
                dataType:'json',  
                type:'get',  
                timeout:'5000',//超时时间设置5秒  
                success:function(data){  
                    data = eval(data);  
                    plus.nativeUI.closeWaiting();  

                    //循环输出直播列表  
                    mui.each(data,function(i,n){  
                        var livelist = document.getElementById("livelist");  
                        var li  = document.createElement("li");  
                        var a   = document.createElement("a");  
                        var img = document.createElement("img");  
                        var div = document.createElement("div");  
                        var span= document.createElement("span");  
                        var span2 = document.createElement("span");  
                        //var span= document.createElement("span");  

                        livelist.setAttribute('style',' min-height: '+MinHeightforList+'px;');  
                        a.addEventListener('click', function(){localStorage.setItem('liveid',n.id);location.href = "show.html";});  
                        a.setAttribute('id',n.id);  
                        img.setAttribute('class','mui-media-object');  
                        img.setAttribute('src',n.livePic ? n.livePic : 'images/logo.png');  
                        img.setAttribute('style','height: 100px; width: 200px;');  

                        div.setAttribute('class','mui-media-body');  
                        div.setAttribute('style','text-align: left; position:relative;');  
                        span.setAttribute('style',' float:left; display: block; left:3px; padding: 1px 0px; max-width: 100px;overflow: hidden;text-overflow: ellipsis;');  
                        span2.setAttribute('style',' float: right; display: block; padding: 1px 0px; max-width: 50px;overflow: hidden;text-overflow: ellipsis; color: #414141;');  
                        span.innerText = n.name;  
                        span2.innerText = n.location;  

                        li.className = 'mui-table-view-cell mui-media mui-col-xs-6';  
                        li.appendChild(a);  
                        a.appendChild(img);  
                        a.appendChild(div);  
                        div.appendChild(span);  
                        div.appendChild(span2);  
                        livelist.appendChild(li);  

                        //open show.html  
                        var liveid = n.id;  

                        live = document.getElementById(liveid);  

                        live.addEventListener('tap',function(e){  
                            localStorage.setItem('liveid',liveid);  

                            location.href = "show.html";  
                        });  
                    });  
                },  
                error:function(xhr,type,errorThrown){  
                    console.log(type);  
                    plus.nativeUI.closeWaiting();  
                    mui.toast('获取参数失败');  
                }  
            });  
        }

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