hldy_app/unpackage/dist/dev/mp-weixin/pages/login/login.js

47 lines
1.4 KiB
JavaScript
Raw Normal View History

2025-02-27 17:15:17 +08:00
"use strict";
const common_vendor = require("../../common/vendor.js");
const _sfc_main = {
data() {
return {
startX: 0,
startY: 0,
isDragging: false
};
},
methods: {
// 手指触摸开始
onTouchStart(e) {
this.startX = e.touches[0].clientX;
this.startY = e.touches[0].clientY;
this.isDragging = false;
},
// 手指滑动
onTouchMove(e) {
const moveX = e.touches[0].clientX - this.startX;
const moveY = e.touches[0].clientY - this.startY;
if (Math.abs(moveX) > Math.abs(moveY)) {
this.isDragging = true;
} else {
this.isDragging = true;
}
if (this.isDragging) {
e.preventDefault();
}
},
// 手指抬起
onTouchEnd() {
this.isDragging = false;
}
}
};
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
return {
a: common_vendor.o((...args) => $options.onTouchStart && $options.onTouchStart(...args)),
b: common_vendor.o((...args) => $options.onTouchMove && $options.onTouchMove(...args)),
c: common_vendor.o((...args) => $options.onTouchEnd && $options.onTouchEnd(...args))
};
}
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-e4e4508d"]]);
wx.createPage(MiniProgramPage);
//# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/login/login.js.map