//判断是否是平板
function IsTouchEnabled() {
return ( 'ontouchstart' in window ) ||
( navigator.maxTouchPoints > 0 ) ||
( navigator.msMaxTouchPoints > 0 )
}
@touchstart
@touchmove
const isPad = IsTouchEnabled()
const rect = e.target.getBoundingClientRect()
const StartX = isPad ? (e.touches[0].clientX - rect.x) : e.offsetX
const StartY = isPad ? (e.touches[0].clientY - rect.y) : e.offsetY
@touchend
const rect = e.target.getBoundingClientRect()
const EndX = isPad ? (e.changedTouches[0].clientX - rect.x) : e.offsetX
const EndY = isPad ? (e.changedTouches[0].clientY - rect.y) : e.offsetY