Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
461 views
in Technique[技术] by (71.8m points)

Hybrid应用web端绑定点击事件相关的问题

之前没开发过hybrid的应用,第一次开发。用的是zepto绑定事件,共用方法里对全局的data-event绑定相关事件,回调函数里判断是不是客户端然后跳转到相应的链接。但在iOS端出了问题。iOS捕获到的事件不是click而是other(因为不是iOS开发具体的事件名称记不住了),后面的事件也不执行了。这是哪出了问题?用的是之前的工程文件,绑定点击事件都是封装好的,在iOS里是不能用的么?

绑定事件的方法

addEvent = function(handle) {
EHS = $.extend({}, EHS, handle);

return $(document).off('click.page')
    .on('click.page', '[data-event]', function(event) {
        if(DEBUG){
            console.log.apply(console, [].slice.call(arguments, 0));
        }
        try {
            var el = $(this),
                de = el.attr('data-event'),
                fn;

            if (el.is('.disabled,[disabled]')) return false;

            if (fn = EHS[de]) {
                fn(el, event);
            }
        } catch (e) {
            throw new Error(e)
        }
    });
};

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...