微信小程序 功能函数 touch触摸计时

shiFN:function(e){
// touchstart
// touchend
let that=this;
let n=0;
// 判断是开始还是结束的参数
let textTure = e.type;
that.setData({
textTure: textTure
})
if (textTure =='touchstart'){
let lovetime = setInterval(function () {
n += 0.5;
 
if (that.data.textTure=='touchend') {
clearInterval(lovetime);
}
console.log(n);
that.setData({
bian: n
})
}, 500)
 
}
},
 
<view class='bt-item' bindtouchend='shiFN' bindtouchstart='shiFN'></view>
原文地址:https://www.cnblogs.com/dianzan/p/8328547.html