首页 > 数据库技术 > 详细

react fake double , bind click and dblclick on the same element

时间:2016-05-23 16:51:48      阅读:248      评论:0      收藏:0      [点我收藏+]

 

 

smartClick:function(id,name,waiter,e){
                var desk = $$(e.currentTarget).data(‘raw‘);
                if(this.lastClickTime[id] && ((new Date())-this.lastClickTime[id])>70)
                {//quick click twice , it seems a dblclick
                    console.log(‘dblclick‘);
                    this.lastClickTime[id]=undefined;
                    this.clickHandler && clearTimeout(this.clickHandler);
                    this.clickHandler = 0;
                    return;
                }

                if(!this.clickHandler)
                {
                    this.clickHandler=setTimeout(function(){
                        console.log(‘click‘);
                        this.lastClickTime[id]=undefined;
                        clearTimeout(this.clickHandler);
                        this.clickHandler = 0;
                    }.bind(this),300);
                    this.lastClickTime[id]=new Date();    
                }                
                return;
                
            },

 

react fake double , bind click and dblclick on the same element

原文:http://www.cnblogs.com/zyip/p/5520324.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!