touchmove 写拖动事件卡顿不流畅
页面上有个fixed悬浮按钮,希望可以在页面上任意拖动位置,但是现在的问题是写出来的拖动效果特别不流畅(反应延迟),请问有什么好的办法解决? <view class='helpbox' style="bottom:{{bottom}}px;right:{{right}}px;" catchtouchmove='setTouchMove'> <image class='helpimg' src='/images/help.png'></image> </view> js代码: setTouchMove:function(e){ var that = this; var width = 35 * rpx; var screenWidth = wx.getSystemInfoSync().windowWidth; var screenHeight = wx.getSystemInfoSync().windowHeight; var clientX = e.touches[0].clientX; var clientY = e.touches[0].clientY; //此处clientY与clientX为拖动悬浮窗超过设定的大小会返回默认显示位置 if (clientX < (screenWidth - width) && clientY < (screenHeight - width) && clientX > width && clientY > width) { that.setData({ right: screenWidth - clientX - width, bottom: screenHeight - clientY - width }) } else { return; // that.setData({ // right: 0, //默认显示位置 left距离 // bottom: 0 //默认显示位置 top距离 // }) } }