如图:
代码:
data: { clickNum:1, lastTapTime:0, }
btnclick:function(e){ var me=this; var curTime = e.timeStamp //获取时间戳 var lastTime = me.data.lastTapTime; //第一次获取为零 console.log("上一次点击时间:"+lastTime) console.log("这一次点击时间:" + curTime) if (curTime - lastTime < 500) { me.setData({clickNum:me.data.clickNum+1}) }else{ me.setData({clickNum:1}) } console.log("me.data.clickNum:",me.data.clickNum); if(me.data.clickNum==3){//想定义双击就换成2,三击就换成3... console.log("点击3次,进入");//这里写想要执行的代码块 } me.setData({ lastTapTime: curTime }) },
参考链接: https://blog.csdn.net/wwwwerewrew/article/details/105794533
标签:me,连击,console,log,自定义,clickNum,事件,curTime,data From: https://www.cnblogs.com/520BigBear/p/16906147.html