还款日历(二)

1.touchstart

// 手指按下的时候记录按下的位置
this.startX = ev.touches[0].clientX;
this.startY = ev.touches[0].clientY;

2.touchend

// 手指移动结束后的水平位置
let endX = event.changedTouches[0].clientX;
// 触摸开始与结束,手指移动的距离
this.disX = this.startX - endX;
//距离1.dX<10,向左滑动   2.dX>10向右滑动  3.-10=<dX<=10不滑动
if(this.disX*1>offset){
this.$refs.Calendars.NextMonth();
}else if(this.disX*1<-offset){
this.$refs.Calendars.PreMonth();
}


原文地址:https://www.cnblogs.com/huangqiao/p/11435838.html