onLoad: function () { var that = this; // 获取屏幕宽度 wx.getSystemInfo({ success: function (res) { that.setData({ screenWidth: res.screenWidth }) }, }) }, // 开始移动 moveSendBtnStart: function (e) { if (!this.data.moveable) { return; } console.log("start"); console.log(e); this.setData({ moveStartX: e.changedTouches["0"].clientX }) }, //移动发送按钮 moveSendBtn: function (e) { if (!this.data.moveable) { return; } var that = this; // console.log(e.touches[0]); var left = ((e.touches[0].clientX - that.data.moveStartX) / (that.data.screenWidth / 750)) console.log(left) if (left <= 275.5) { this.setData({ moveSendBtnLeft: left }) } else {
this.setData({ moveSendBtnLeft: 275.5 }) } }, // 结束移动 moveSendBtnEnd: function (e) { console.log("end"); var that = this; var left = ((e.changedTouches[0].clientX - that.data.moveStartX) / (that.data.screenWidth / 750)) console.log(left); if (left < 275.5) { for (let i = left; i >= 0; i--) {