64 lines
2.2 KiB
JavaScript
64 lines
2.2 KiB
JavaScript
"use strict";
|
|
const common_vendor = require("../../../common/vendor.js");
|
|
const _sfc_main = {
|
|
methods: {
|
|
// 基本点击
|
|
handleTap(e) {
|
|
common_vendor.index.__f__("log", "at pages/index/hammerjsTest/hammerjsTest.vue:20", "Tap:", e);
|
|
},
|
|
// 平移拖拽
|
|
handlePan(e) {
|
|
const { displacement, deltaX, deltaY } = e;
|
|
common_vendor.index.__f__("log", "at pages/index/hammerjsTest/hammerjsTest.vue:26", `Pan: X=${deltaX}, Y=${deltaY}, 位移=${displacement}px`);
|
|
},
|
|
// 快速滑动
|
|
handleSwipe(e) {
|
|
const { direction } = e;
|
|
const dirMap = {
|
|
left: "向左",
|
|
right: "向右",
|
|
up: "向上",
|
|
down: "向下"
|
|
};
|
|
common_vendor.index.__f__("log", "at pages/index/hammerjsTest/hammerjsTest.vue:38", `Swipe: ${dirMap[direction]}`);
|
|
},
|
|
// 缩放
|
|
handlePinch(e) {
|
|
common_vendor.index.__f__("log", "at pages/index/hammerjsTest/hammerjsTest.vue:43", `缩放比例: ${e.scale.toFixed(2)}倍`);
|
|
},
|
|
// 长按
|
|
handlePress(e) {
|
|
common_vendor.index.__f__("log", "at pages/index/hammerjsTest/hammerjsTest.vue:48", `长按 ${e.duration}ms`);
|
|
},
|
|
// 旋转
|
|
handleRotate(e) {
|
|
common_vendor.index.__f__("log", "at pages/index/hammerjsTest/hammerjsTest.vue:53", `旋转角度: ${e.angle.toFixed(1)}°`);
|
|
}
|
|
}
|
|
};
|
|
if (!Array) {
|
|
const _component_any_touch = common_vendor.resolveComponent("any-touch");
|
|
_component_any_touch();
|
|
}
|
|
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
return {
|
|
a: common_vendor.o($options.handleTap),
|
|
b: common_vendor.o($options.handlePan),
|
|
c: common_vendor.o($options.handleSwipe),
|
|
d: common_vendor.o($options.handlePinch),
|
|
e: common_vendor.o($options.handlePress),
|
|
f: common_vendor.o($options.handleRotate),
|
|
g: common_vendor.p({
|
|
["pan-options"]: {
|
|
threshold: 10
|
|
},
|
|
["pinch-options"]: {
|
|
threshold: 0.1
|
|
}
|
|
})
|
|
};
|
|
}
|
|
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render]]);
|
|
wx.createPage(MiniProgramPage);
|
|
//# sourceMappingURL=../../../../.sourcemap/mp-weixin/pages/index/hammerjsTest/hammerjsTest.js.map
|