@dolphinweex/weex-harmony 0.1.29 → 0.1.30

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dolphinweex/weex-harmony",
3
- "version": "0.1.29",
3
+ "version": "0.1.30",
4
4
  "description": "weex harmony adapter",
5
5
  "main": "index.js",
6
6
  "files": [
@@ -152,6 +152,7 @@
152
152
  </template>
153
153
 
154
154
  <script>
155
+ import { weex_harmony_rebindGestureDelayed } from '@dolphinweex/harmony-webpack-adapter/registerGesture.js'; // 请替换为实际的loader文件路径
155
156
  import lottie from 'lottie-web';
156
157
  const scla = 2;
157
158
  export default {
@@ -198,6 +199,10 @@ export default {
198
199
  fixedItemHeight: 0,
199
200
  animationFrameId: null,
200
201
  isProcessingData: false,
202
+ // 手势事件配置 - 根据实际使用的手势事件来配置
203
+ gestureEventMap: [],
204
+ // 元素ID - 用于标识需要绑定手势的元素
205
+ elementId: 'grid-item'
201
206
  };
202
207
  },
203
208
  computed: {
@@ -282,9 +287,59 @@ export default {
282
287
  if (oldFrontAnimUrl !== newFrontAnimUrl && newFrontAnimUrl) {
283
288
  this.createLottieAnimation('front', itemId, mergedData.frontAnimView, mergedData);
284
289
  }
290
+ // 重新绑定手势事件 - 解决DOM更新后手势失效问题
291
+ this.rebindGestureEvents();
285
292
  });
286
293
  },
287
-
294
+ // 重新绑定手势事件的方法
295
+ rebindGestureEvents() {
296
+ try {
297
+ // 延迟执行确保DOM完全更新
298
+ weex_harmony_rebindGestureDelayed(
299
+ this.$el, // 组件根元素
300
+ this.gestureEventMap, // 手势事件配置数组
301
+ this.elementId, // 元素类名ID
302
+ 100 // 延迟100ms
303
+ );
304
+ console.log('手势事件重新绑定完成');
305
+ } catch (error) {
306
+ console.error('重新绑定手势事件失败:', error);
307
+ }
308
+ },
309
+ // 初始化手势事件配置
310
+ initGestureConfig() {
311
+ // 根据你实际使用的手势事件来配置
312
+ this.gestureEventMap = [
313
+ {
314
+ name: "@touchstart",
315
+ handler: this.startLongPress,
316
+ params: ['event', 'index'],
317
+ isEvent: true,
318
+ modifier: []
319
+ },
320
+ {
321
+ name: "@touchmove",
322
+ handler: this.checkLongPressMove,
323
+ params: [],
324
+ isEvent: true,
325
+ modifier: []
326
+ },
327
+ {
328
+ name: "@touchend",
329
+ handler: this.endTouch,
330
+ params: [],
331
+ isEvent: true,
332
+ modifier: []
333
+ },
334
+ {
335
+ name: "@touchcancel",
336
+ handler: this.endTouch,
337
+ params: [],
338
+ isEvent: true,
339
+ modifier: []
340
+ }
341
+ ];
342
+ },
288
343
  // 简化的动画创建方法
289
344
  createLottieAnimation(type, itemId, animView, itemData) {
290
345
  const animKey = `${type}-${itemId}`;
@@ -956,12 +1011,15 @@ export default {
956
1011
  this.generateDataList();
957
1012
  this.$nextTick(() => {
958
1013
  this.initLottieAnimations();
1014
+ this.rebindGestureEvents();
959
1015
  });
960
1016
  },
961
1017
  deep: true,
962
1018
  },
963
1019
  },
1020
+
964
1021
  mounted() {
1022
+ this.initGestureConfig()
965
1023
  console.log(this.data, 'djdjdjdjdjdjdj');
966
1024
  // 初始获取grid-box宽度
967
1025
  this.updateGridBoxWidth();