加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 资源网站 > 资源 > 正文

微信小程序实例:点击事件和长按事件的代码实现

发布时间:2020-12-14 20:01:20 所属栏目:资源 来源:网络整理
导读:本篇文章给大家带来的内容是关于微信小程序实例:点击事件和长按事件的代码实现,有一定的参考价值,有需要的朋友可以参考一下,希望对你有所帮助。 点击/长按 //touch starthandleTouchStart: function(e) { this.startTime = e.timeStamp; //console.log("

本篇文章给大家带来的内容是关于微信小程序实例:点击事件和长按事件的代码实现,有一定的参考价值,有需要的朋友可以参考一下,希望对你有所帮助。

 
//touch start
handleTouchStart: function(e) {    
    this.startTime = e.timeStamp;    
    //console.log(" startTime = " + e.timeStamp);  
},//touch end
handleTouchEnd: function(e) {    
    this.endTime = e.timeStamp;    
    //console.log(" endTime = " + e.timeStamp);  
},handleClick: function(e) {    
    //console.log("endTime - startTime = " + (this.endTime - this.startTime));    
    if (this.endTime - this.startTime < 350) {      
    console.log("点击");    
    }  
},handleLongPress: function(e) {    
//console.log("endTime - startTime = " + (this.endTime - this.startTime));
console.log("长按");  
},

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读