Applet long press event

Finger press the trigger event;
/**
* Finger touch event
*/
touchStart: function (e) {
var that = this;
that.setData({
touchStart: e.timeStamp
})
},
touchEnd: function (e) {
var that = this ;
that.setData({
touchEnd: e.timeStamp
})
},
pressTap: function () {
var that = this ;
var touchTime = that.data.touchEnd - that.data.touchStart;
IF (touchTime> 3000 ) { // custom length long time, in ms
if (that.data.isManager == true) {
if (that.data.status == 1){
wx.showModal({
title: 'Tips' ,
content: 'You will switch to preview mode! ' ,
success: function (res) {
if (res.confirm) {
that.setData({ status: 0 })
that.getHouseList( 0);
}
}
})
} else{
wx.showModal({
title: '提示',
content: '你将切换到正常模式!',
success: function (res) {
if (res.confirm) {
that.setData({ status: 1 })
that.getHouseList( 1);
}
}
})
}
}
}
},

Guess you like

Origin blog.csdn.net/wwj791859814/article/details/80193320