[Improvement] Swipe: optimzie performance (#985)

This commit is contained in:
neverland
2018-05-04 15:21:24 +08:00
committed by GitHub
parent 997780f2f5
commit 2899a4cb8e
4 changed files with 83 additions and 96 deletions

View File

@@ -16,10 +16,7 @@ export default {
this.deltaY = touch.clientY - this.startY;
this.offsetX = Math.abs(this.deltaX);
this.offsetY = Math.abs(this.deltaY);
if (!this.direction) {
this.direction = this.offsetX > this.offsetY ? 'horizontal' : this.offsetX < this.offsetY ? 'vertical' : '';
}
this.direction = this.offsetX > this.offsetY ? 'horizontal' : this.offsetX < this.offsetY ? 'vertical' : '';
}
}
};