@dolphinweex/weex-harmony 0.1.24 → 0.1.26
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
@@ -200,6 +200,10 @@ export default {
|
|
200
200
|
lastBestTarget: null,
|
201
201
|
targetChangeTime: null,
|
202
202
|
pendingTarget: null,
|
203
|
+
weexListInnerEl: null,
|
204
|
+
weexRefreshEl: null,
|
205
|
+
originListInnerStyle: null,
|
206
|
+
originRefreshStyle: null,
|
203
207
|
};
|
204
208
|
},
|
205
209
|
computed: {
|
@@ -242,6 +246,28 @@ export default {
|
|
242
246
|
},
|
243
247
|
},
|
244
248
|
methods: {
|
249
|
+
searchDom(){
|
250
|
+
//在 slider组件内部时 阻止默认行为和冒泡都无法在长按的时候 阻止其滚动行为 只能查找去禁止
|
251
|
+
const currentEl = this.$el;
|
252
|
+
let parentEl = currentEl.parentElement;
|
253
|
+
let searchDepth = 0; // 搜索深度计数器
|
254
|
+
while (parentEl && !parentEl.classList.contains('weex-list-inner') && searchDepth < 5) {
|
255
|
+
parentEl = parentEl.parentElement;
|
256
|
+
searchDepth++;
|
257
|
+
}
|
258
|
+
|
259
|
+
if (parentEl) {
|
260
|
+
this.weexListInnerEl = parentEl;
|
261
|
+
this.originListInnerStyle = parentEl.style.touchAction || '';
|
262
|
+
|
263
|
+
// 在weex-list-inner中查找weex-refresh子元素
|
264
|
+
const refreshEl = parentEl.querySelector('.weex-refresh');
|
265
|
+
if (refreshEl) {
|
266
|
+
this.weexRefreshEl = refreshEl;
|
267
|
+
this.originRefreshStyle = refreshEl.style.height || '';
|
268
|
+
}
|
269
|
+
}
|
270
|
+
},
|
245
271
|
updateListItem(data) {
|
246
272
|
console.log('updateListItem收到数据:', JSON.stringify(data));
|
247
273
|
const id = data.itemView.id;
|
@@ -251,18 +277,16 @@ export default {
|
|
251
277
|
const dataIndex = this.data.list.findIndex(
|
252
278
|
(item) => item.itemView.id === id
|
253
279
|
);
|
254
|
-
|
280
|
+
// 更新原始数据以确保watch能触发
|
281
|
+
if (dataIndex !== -1) {
|
282
|
+
// 使用Vue的$set确保响应式更新
|
283
|
+
this.$set(this.data.list, dataIndex, JSON.parse(JSON.stringify(data)));
|
284
|
+
}
|
255
285
|
if (index === -1) {
|
256
286
|
return;
|
257
287
|
}
|
258
288
|
|
259
|
-
|
260
|
-
const oldVisibility = this.processedList[index].actionButton.visibility;
|
261
|
-
const newVisibility = data.actionButton.visibility;
|
262
|
-
|
263
|
-
if (typeof newVisibility === 'number') {
|
264
|
-
console.log(`按钮可见性从 ${oldVisibility} 变更为 ${newVisibility}`);
|
265
|
-
}
|
289
|
+
|
266
290
|
|
267
291
|
// 检查是否有动画URL的变化
|
268
292
|
const oldBgAnimUrl = this.processedList[index].bgAnimView.animUrl || '';
|
@@ -270,7 +294,6 @@ export default {
|
|
270
294
|
this.processedList[index].loadingAnimView.animUrl || '';
|
271
295
|
const oldFrontAnimUrl =
|
272
296
|
this.processedList[index].frontAnimView.animUrl || '';
|
273
|
-
|
274
297
|
const newBgAnimUrl = data.bgAnimView.animUrl || '';
|
275
298
|
const newLoadingAnimUrl = data.loadingAnimView.animUrl || '';
|
276
299
|
const newFrontAnimUrl = data.frontAnimView.animUrl || '';
|
@@ -292,7 +315,6 @@ export default {
|
|
292
315
|
|
293
316
|
// 如果动画URL有变化,重新初始化相关的Lottie动画
|
294
317
|
if (hasAnimUrlChanged) {
|
295
|
-
console.log('检测到动画URL变化,重新初始化动画');
|
296
318
|
|
297
319
|
// 等待下一帧DOM更新完成后再操作
|
298
320
|
this.$nextTick(() => {
|
@@ -307,7 +329,6 @@ export default {
|
|
307
329
|
];
|
308
330
|
animKeys.forEach((key) => {
|
309
331
|
if (this.lottieAnimations[key]) {
|
310
|
-
console.log(`销毁动画实例: ${key}`);
|
311
332
|
const anim = this.lottieAnimations[key];
|
312
333
|
try {
|
313
334
|
anim.removeEventListener('complete');
|
@@ -316,14 +337,12 @@ export default {
|
|
316
337
|
anim.removeEventListener('loaded_images');
|
317
338
|
anim.removeEventListener('loopComplete');
|
318
339
|
} catch (e) {
|
319
|
-
console.warn(`移除事件监听器失败: ${e.message}`);
|
320
340
|
}
|
321
341
|
anim.destroy();
|
322
342
|
delete this.lottieAnimations[key];
|
323
343
|
}
|
324
344
|
});
|
325
345
|
|
326
|
-
console.log('清理完成,开始重新初始化动画');
|
327
346
|
|
328
347
|
// 延迟一点时间确保DOM完全更新
|
329
348
|
setTimeout(() => {
|
@@ -372,7 +391,6 @@ export default {
|
|
372
391
|
callback({ listData: data });
|
373
392
|
},
|
374
393
|
rightIconClick(e) {
|
375
|
-
console.log('rightIconClick执行,阻止事件冒泡');
|
376
394
|
e.preventDefault();
|
377
395
|
e.stopPropagation();
|
378
396
|
this.$emit('onClickRightIcon', e);
|
@@ -406,7 +424,6 @@ export default {
|
|
406
424
|
}
|
407
425
|
e.preventDefault();
|
408
426
|
e.stopPropagation();
|
409
|
-
console.log('itemViewClick');
|
410
427
|
// 确保取消任何长按计时器
|
411
428
|
this.cancelLongPress();
|
412
429
|
if (this.data.isEditing) {
|
@@ -424,7 +441,6 @@ export default {
|
|
424
441
|
},
|
425
442
|
|
426
443
|
actionClick(e, item, index) {
|
427
|
-
console.log('actionClick执行,阻止事件冒泡');
|
428
444
|
e.preventDefault();
|
429
445
|
e.stopPropagation(); // 阻止事件冒泡到itemViewClick
|
430
446
|
|
@@ -443,14 +459,12 @@ export default {
|
|
443
459
|
|
444
460
|
// 新增方法:清理除指定项目外的所有动画实例
|
445
461
|
cleanupOtherAnimations(currentItemId) {
|
446
|
-
console.log('清理其他项目的动画实例,当前项目ID:', currentItemId);
|
447
462
|
|
448
463
|
// 遍历所有动画实例
|
449
464
|
Object.keys(this.lottieAnimations).forEach((key) => {
|
450
465
|
// 检查是否为其他项目的动画
|
451
466
|
if (!key.includes(`-${currentItemId}`)) {
|
452
467
|
if (this.lottieAnimations[key]) {
|
453
|
-
console.log(`销毁其他项目的动画实例: ${key}`);
|
454
468
|
const anim = this.lottieAnimations[key];
|
455
469
|
|
456
470
|
// 移除所有事件监听器
|
@@ -479,7 +493,6 @@ export default {
|
|
479
493
|
const animContainer =
|
480
494
|
this.$refs[refName] && this.$refs[refName][0];
|
481
495
|
if (animContainer) {
|
482
|
-
console.log(`隐藏动画容器: ${refName}`);
|
483
496
|
animContainer.style.display = 'none';
|
484
497
|
}
|
485
498
|
});
|
@@ -523,7 +536,6 @@ export default {
|
|
523
536
|
},
|
524
537
|
getItemStyle(item, type) {
|
525
538
|
const result = this.mergeDate(item[type] || {}, type);
|
526
|
-
console.log(type, this.applyNormalAttribute(result), 'ggg');
|
527
539
|
return this.applyNormalAttribute(result);
|
528
540
|
},
|
529
541
|
mergeDate(target, type) {
|
@@ -599,7 +611,6 @@ export default {
|
|
599
611
|
const touch = e.changedTouches[0];
|
600
612
|
this.touchStartX = touch.pageX;
|
601
613
|
this.touchStartY = touch.pageY;
|
602
|
-
console.log('开始长按ddddddddd', touch, touch.pageY, touch.pageX);
|
603
614
|
this.longPressStartIndex = index;
|
604
615
|
this.isScrolling = false; // 重置滚动状态
|
605
616
|
|
@@ -616,9 +627,7 @@ export default {
|
|
616
627
|
items: [...this.itemsList],
|
617
628
|
});
|
618
629
|
}
|
619
|
-
|
620
|
-
`准备长按: index=${index}, 触摸坐标=(${touch.pageX}, ${touch.pageY})`
|
621
|
-
);
|
630
|
+
|
622
631
|
|
623
632
|
// 设置新的长按计时器
|
624
633
|
this.longPressTimer = setTimeout(() => {
|
@@ -632,7 +641,6 @@ export default {
|
|
632
641
|
|
633
642
|
// 检查长按过程中的移动
|
634
643
|
checkLongPressMove(e) {
|
635
|
-
this.data.isEditing && e.oriEvent.stopPropagation()
|
636
644
|
if (!this.data.isEditable) {
|
637
645
|
return;
|
638
646
|
}
|
@@ -642,7 +650,6 @@ export default {
|
|
642
650
|
this.onTouchMove(e);
|
643
651
|
return;
|
644
652
|
}
|
645
|
-
|
646
653
|
const moveX = Math.abs(touch.pageX - this.touchStartX);
|
647
654
|
const moveY = Math.abs(touch.pageY - this.touchStartY);
|
648
655
|
|
@@ -658,20 +665,14 @@ export default {
|
|
658
665
|
if (moveX > this.scrollThreshold || moveY > this.scrollThreshold) {
|
659
666
|
this.cancelLongPress();
|
660
667
|
}
|
668
|
+
this.data.isEditing && e.oriEvent.stopPropagation()
|
669
|
+
this.data.isEditing && e.oriEvent.preventDefault()
|
661
670
|
|
662
|
-
// 不阻止默认行为,允许滚动
|
663
671
|
},
|
664
672
|
|
665
673
|
// 激活拖拽模式
|
666
674
|
activateDragMode(index) {
|
667
675
|
console.log('长按触发,进入编辑模式');
|
668
|
-
// 进入编辑模式
|
669
|
-
this.data.isEditing = true;
|
670
|
-
this.$emit('onEditStateChanged', true);
|
671
|
-
// 设置当前拖拽索引
|
672
|
-
this.draggingIndex = index;
|
673
|
-
this.isTouchDragging = true;
|
674
|
-
|
675
676
|
// 此时添加阻止默认行为的事件监听,但只影响拖拽状态下的行为
|
676
677
|
document.addEventListener('touchmove', this.onTouchMove, {
|
677
678
|
passive: false, // 只有在拖拽模式下才阻止默认行为
|
@@ -679,38 +680,50 @@ export default {
|
|
679
680
|
document.addEventListener('touchend', this.onTouchEnd, {
|
680
681
|
passive: true,
|
681
682
|
});
|
683
|
+
if (this.data.isEditing) {
|
684
|
+
// 设置当前拖拽索引
|
685
|
+
this.draggingIndex = index;
|
686
|
+
this.isTouchDragging = true;
|
687
|
+
|
688
|
+
// 使用存储的固定宽高
|
689
|
+
this.draggedItemRect = {
|
690
|
+
width: this.fixedItemWidth,
|
691
|
+
height: this.fixedItemHeight,
|
692
|
+
};
|
693
|
+
|
694
|
+
// 获取当前元素位置用于计算偏移
|
695
|
+
const element = document.querySelectorAll('.grid-item')[index];
|
696
|
+
if (element) {
|
697
|
+
const rect = element.getBoundingClientRect();
|
698
|
+
// 计算触摸点相对于元素左上角的偏移
|
699
|
+
this.touchOffsetX = this.touchStartX - rect.left;
|
700
|
+
this.touchOffsetY = this.touchStartY - rect.top;
|
701
|
+
|
702
|
+
// 设置克隆元素的初始位置
|
703
|
+
this.dragCloneX = rect.left;
|
704
|
+
this.dragCloneY = rect.top;
|
705
|
+
|
706
|
+
// 显示拖拽克隆
|
707
|
+
this.isDragClone = true;
|
708
|
+
|
709
|
+
// 立即执行一次定位以确保初始位置准确
|
710
|
+
requestAnimationFrame(() => {
|
711
|
+
this.dragCloneX = this.touchStartX - this.touchOffsetX;
|
712
|
+
this.dragCloneY = this.touchStartY - this.touchOffsetY;
|
713
|
+
});
|
682
714
|
|
683
|
-
|
684
|
-
|
685
|
-
width: this.fixedItemWidth,
|
686
|
-
height: this.fixedItemHeight,
|
687
|
-
};
|
688
|
-
|
689
|
-
// 获取当前元素位置用于计算偏移
|
690
|
-
const element = document.querySelectorAll('.grid-item')[index];
|
691
|
-
if (element) {
|
692
|
-
const rect = element.getBoundingClientRect();
|
693
|
-
// 计算触摸点相对于元素左上角的偏移
|
694
|
-
this.touchOffsetX = this.touchStartX - rect.left;
|
695
|
-
this.touchOffsetY = this.touchStartY - rect.top;
|
696
|
-
|
697
|
-
// 设置克隆元素的初始位置
|
698
|
-
this.dragCloneX = rect.left;
|
699
|
-
this.dragCloneY = rect.top;
|
700
|
-
|
701
|
-
// 显示拖拽克隆
|
702
|
-
this.isDragClone = true;
|
703
|
-
|
704
|
-
// 立即执行一次定位以确保初始位置准确
|
705
|
-
requestAnimationFrame(() => {
|
706
|
-
this.dragCloneX = this.touchStartX - this.touchOffsetX;
|
707
|
-
this.dragCloneY = this.touchStartY - this.touchOffsetY;
|
708
|
-
});
|
715
|
+
console.log('拖拽克隆已创建');
|
716
|
+
}
|
709
717
|
|
710
|
-
|
718
|
+
this.longPressTimer = null;
|
719
|
+
}
|
720
|
+
// 进入编辑模式
|
721
|
+
if (!this.data.isEditing) {
|
722
|
+
// 设置编辑状态并隐藏weex-refresh
|
723
|
+
this.data.isEditing = true;
|
724
|
+
this.$emit('onEditStateChanged', true);
|
725
|
+
this.applyDragModeStyles(); // 应用编辑模式样式(隐藏refresh)
|
711
726
|
}
|
712
|
-
|
713
|
-
this.longPressTimer = null;
|
714
727
|
},
|
715
728
|
|
716
729
|
// 取消长按计时器
|
@@ -840,6 +853,8 @@ export default {
|
|
840
853
|
this.draggingIndex = bestTarget;
|
841
854
|
this.lastSwapTime = now;
|
842
855
|
}
|
856
|
+
this.data.isEditing && e.oriEvent.stopPropagation()
|
857
|
+
this.data.isEditing && e.oriEvent.preventDefault()
|
843
858
|
},
|
844
859
|
|
845
860
|
// 新增:平滑更新拖拽位置的方法
|
@@ -895,6 +910,12 @@ export default {
|
|
895
910
|
this.isDragClone = false;
|
896
911
|
this.hoverIndex = null;
|
897
912
|
this.draggingIndex = null;
|
913
|
+
|
914
|
+
// 如果不再拖拽,恢复touch-action(但保持refresh隐藏,因为仍在编辑状态)
|
915
|
+
const elements = this.findParentElements();
|
916
|
+
if (elements.listInner) {
|
917
|
+
elements.listInner.style.touchAction = this.originListInnerStyle;
|
918
|
+
}
|
898
919
|
}
|
899
920
|
},
|
900
921
|
|
@@ -902,6 +923,9 @@ export default {
|
|
902
923
|
onTouchEnd(e) {
|
903
924
|
console.log('全局触摸结束');
|
904
925
|
|
926
|
+
// 恢复拖拽模式前的样式
|
927
|
+
this.restoreDragModeStyles();
|
928
|
+
|
905
929
|
// 移除全局事件监听
|
906
930
|
document.removeEventListener('touchmove', this.onTouchMove, {
|
907
931
|
passive: false,
|
@@ -977,12 +1001,6 @@ export default {
|
|
977
1001
|
// 为每个列表项初始化动画
|
978
1002
|
this.processedList.forEach((item) => {
|
979
1003
|
const itemId = item.itemView.id;
|
980
|
-
|
981
|
-
console.log('处理项目ID:', itemId);
|
982
|
-
console.log('loadingAnimView:', item.loadingAnimView);
|
983
|
-
console.log('bgAnimView:', item.bgAnimView);
|
984
|
-
console.log('frontAnimView:', item.frontAnimView);
|
985
|
-
|
986
1004
|
// 加载背景动画
|
987
1005
|
this.loadLottieAnimation(
|
988
1006
|
item.bgAnimView,
|
@@ -1014,27 +1032,17 @@ export default {
|
|
1014
1032
|
// 抽取公共的loadLottieAnimation方法
|
1015
1033
|
loadLottieAnimation(animView, refName, animKey, item) {
|
1016
1034
|
if (!animView || !animView.animUrl) {
|
1017
|
-
console.log(`[${animKey}] 跳过加载:animUrl不存在`);
|
1018
1035
|
return;
|
1019
1036
|
}
|
1020
1037
|
|
1021
|
-
console.log(
|
1022
|
-
`[${animKey}] 尝试初始化${refName}, animUrl:`,
|
1023
|
-
animView.animUrl,
|
1024
|
-
'可见性:',
|
1025
|
-
animView.visibility
|
1026
|
-
);
|
1027
|
-
|
1028
1038
|
const animEl = this.$refs[refName];
|
1029
1039
|
if (!animEl || !animEl[0]) {
|
1030
|
-
console.warn(`[${animKey}] 未找到${refName}的DOM引用,请检查DOM结构`);
|
1031
1040
|
return;
|
1032
1041
|
}
|
1033
1042
|
|
1034
1043
|
try {
|
1035
1044
|
// 如果已经有实例,先销毁它
|
1036
1045
|
if (this.lottieAnimations[animKey]) {
|
1037
|
-
console.log(`[${animKey}] 销毁现有的动画实例`);
|
1038
1046
|
this.lottieAnimations[animKey].destroy();
|
1039
1047
|
delete this.lottieAnimations[animKey];
|
1040
1048
|
}
|
@@ -1045,33 +1053,21 @@ export default {
|
|
1045
1053
|
animView.visibility !== 0
|
1046
1054
|
) {
|
1047
1055
|
// 使用fetch方式获取动画数据
|
1048
|
-
console.log(`[${animKey}] 开始获取动画数据:`, animView.animUrl);
|
1049
1056
|
fetch(animView.animUrl)
|
1050
1057
|
.then((response) => {
|
1051
1058
|
if (!response.ok) {
|
1052
|
-
console.error(
|
1053
|
-
`[${animKey}] 获取动画数据失败,HTTP状态码:`,
|
1054
|
-
response.status
|
1055
|
-
);
|
1056
1059
|
throw new Error('Network response was not ok');
|
1057
1060
|
}
|
1058
|
-
console.log(`[${animKey}] 网络请求成功,正在解析JSON`);
|
1059
1061
|
return response.json();
|
1060
1062
|
})
|
1061
1063
|
.then((animationData) => {
|
1062
|
-
console.log(
|
1063
|
-
`[${animKey}] 动画数据已加载,数据大小:`,
|
1064
|
-
JSON.stringify(animationData).length
|
1065
|
-
);
|
1066
1064
|
// 再次检查是否已有实例(可能在fetch期间创建了)
|
1067
1065
|
if (this.lottieAnimations[animKey]) {
|
1068
|
-
console.log(`[${animKey}] 销毁fetch期间创建的动画实例`);
|
1069
1066
|
this.lottieAnimations[animKey].destroy();
|
1070
1067
|
delete this.lottieAnimations[animKey];
|
1071
1068
|
}
|
1072
1069
|
|
1073
1070
|
// 创建新的动画实例
|
1074
|
-
console.log(`[${animKey}] 创建新的动画实例`);
|
1075
1071
|
const anim = lottie.loadAnimation({
|
1076
1072
|
container: animEl[0],
|
1077
1073
|
renderer: 'svg',
|
@@ -1087,15 +1083,10 @@ export default {
|
|
1087
1083
|
this.lottieAnimations[animKey] = anim;
|
1088
1084
|
|
1089
1085
|
// 添加动画事件监听
|
1090
|
-
anim.addEventListener('DOMLoaded', () => {
|
1091
|
-
console.log(`[${animKey}] 动画DOM已加载完成`);
|
1092
|
-
});
|
1093
1086
|
|
1094
1087
|
anim.addEventListener('complete', () => {
|
1095
|
-
console.log(`[${animKey}] 动画播放完成一次`);
|
1096
1088
|
// 检查是否需要销毁动画(非循环动画完成后销毁)
|
1097
1089
|
if (!item.animRepeatCount) {
|
1098
|
-
console.log(`[${animKey}] 非循环动画播放完成,执行销毁`);
|
1099
1090
|
// 销毁前再次检查实例是否存在
|
1100
1091
|
if (this.lottieAnimations[animKey] === anim) {
|
1101
1092
|
anim.removeEventListener('complete');
|
@@ -1105,7 +1096,6 @@ export default {
|
|
1105
1096
|
anim.removeEventListener('loopComplete');
|
1106
1097
|
anim.destroy();
|
1107
1098
|
delete this.lottieAnimations[animKey];
|
1108
|
-
console.log(`[${animKey}] 动画实例已销毁`);
|
1109
1099
|
|
1110
1100
|
// 查找并隐藏对应的动画容器
|
1111
1101
|
this.$nextTick(() => {
|
@@ -1174,23 +1164,17 @@ export default {
|
|
1174
1164
|
);
|
1175
1165
|
}
|
1176
1166
|
}
|
1177
|
-
console.log(`[${animKey}] 已清空动画URL数据`);
|
1178
1167
|
}
|
1179
1168
|
});
|
1180
1169
|
}
|
1181
1170
|
}
|
1182
1171
|
});
|
1183
1172
|
|
1184
|
-
console.log(`[${animKey}] ${refName}初始化成功`);
|
1185
1173
|
})
|
1186
1174
|
.catch((error) => {
|
1187
|
-
console.error(`[${animKey}] 加载${refName}动画数据失败:`, error);
|
1188
1175
|
});
|
1189
|
-
}
|
1190
|
-
console.log(`[${animKey}] ${refName}可见性为0,跳过初始化`);
|
1191
|
-
}
|
1176
|
+
}
|
1192
1177
|
} catch (error) {
|
1193
|
-
console.error(`[${animKey}] ${refName}初始化失败,详细错误:`, error);
|
1194
1178
|
}
|
1195
1179
|
},
|
1196
1180
|
|
@@ -1202,23 +1186,51 @@ export default {
|
|
1202
1186
|
const rect = gridItem.getBoundingClientRect();
|
1203
1187
|
this.fixedItemWidth = rect.width;
|
1204
1188
|
this.fixedItemHeight = rect.height;
|
1205
|
-
console.log(
|
1206
|
-
'固定宽高已更新:',
|
1207
|
-
this.fixedItemWidth,
|
1208
|
-
this.fixedItemHeight
|
1209
|
-
);
|
1210
1189
|
}
|
1211
1190
|
});
|
1212
1191
|
},
|
1213
1192
|
|
1214
1193
|
// 暂未使用,但保留用于将来扩展
|
1215
1194
|
leftTopIconClick(e) {
|
1216
|
-
console.log('leftTopIconClick执行,阻止事件冒泡');
|
1217
1195
|
e.preventDefault();
|
1218
1196
|
e.stopPropagation();
|
1219
1197
|
// 这里可以添加将来的处理逻辑
|
1220
1198
|
return false;
|
1221
1199
|
},
|
1200
|
+
|
1201
|
+
// 查找父级元素和refresh元素
|
1202
|
+
findParentElements() {
|
1203
|
+
// 返回存储的元素引用
|
1204
|
+
return {
|
1205
|
+
listInner: this.weexListInnerEl,
|
1206
|
+
refresh: this.weexRefreshEl
|
1207
|
+
};
|
1208
|
+
},
|
1209
|
+
|
1210
|
+
// 进入拖拽模式时应用样式
|
1211
|
+
applyDragModeStyles() {
|
1212
|
+
const elements = this.findParentElements();
|
1213
|
+
|
1214
|
+
// 设置weex-list-inner的touch-action: none(只在拖拽时)
|
1215
|
+
if (elements.listInner && this.isTouchDragging) {
|
1216
|
+
elements.listInner.style.touchAction = 'none';
|
1217
|
+
}
|
1218
|
+
},
|
1219
|
+
|
1220
|
+
// 退出拖拽模式时恢复样式
|
1221
|
+
restoreDragModeStyles() {
|
1222
|
+
const elements = this.findParentElements();
|
1223
|
+
|
1224
|
+
// 恢复weex-list-inner的touch-action(只在拖拽时修改)
|
1225
|
+
if (elements.listInner && this.isTouchDragging) {
|
1226
|
+
elements.listInner.style.touchAction = this.originListInnerStyle;
|
1227
|
+
}
|
1228
|
+
|
1229
|
+
// 如果不在编辑状态,恢复weex-refresh的display
|
1230
|
+
if (elements.refresh && !this.data.isEditing) {
|
1231
|
+
elements.refresh.style.display = 'flex';
|
1232
|
+
}
|
1233
|
+
},
|
1222
1234
|
},
|
1223
1235
|
watch: {
|
1224
1236
|
// 监听初始数据变化
|
@@ -1233,21 +1245,8 @@ export default {
|
|
1233
1245
|
// 监听列表数据变化,自动更新处理后的数据
|
1234
1246
|
'data.list': {
|
1235
1247
|
handler(newList, oldList) {
|
1236
|
-
console.log('检测到data.list变化');
|
1237
1248
|
this.processedList = this.generateDataList();
|
1238
1249
|
this.$nextTick(() => {
|
1239
|
-
// 日志输出当前列表中所有按钮的可见性
|
1240
|
-
if (this.processedList && this.processedList.length > 0) {
|
1241
|
-
console.log('更新后的按钮可见性状态:');
|
1242
|
-
this.processedList.forEach((item, idx) => {
|
1243
|
-
if (item.actionButton) {
|
1244
|
-
console.log(
|
1245
|
-
`项目${idx} (ID:${item.itemView.id}) 按钮可见性: ${item.actionButton.visibility}`
|
1246
|
-
);
|
1247
|
-
}
|
1248
|
-
});
|
1249
|
-
}
|
1250
|
-
|
1251
1250
|
this.updateGridBoxWidth();
|
1252
1251
|
this.updateFixedItemSize();
|
1253
1252
|
this.initLottieAnimations();
|
@@ -1297,10 +1296,6 @@ export default {
|
|
1297
1296
|
oldList[index].bgAnimView &&
|
1298
1297
|
item.bgAnimView.animUrl !== oldList[index].bgAnimView.animUrl
|
1299
1298
|
) {
|
1300
|
-
console.log(
|
1301
|
-
'检测到bgAnimView.animUrl变化:',
|
1302
|
-
item.bgAnimView.animUrl
|
1303
|
-
);
|
1304
1299
|
this.$nextTick(() => {
|
1305
1300
|
const itemId = item.itemView.id;
|
1306
1301
|
if (this.lottieAnimations[`bg-${itemId}`]) {
|
@@ -1323,10 +1318,6 @@ export default {
|
|
1323
1318
|
item.loadingAnimView.animUrl !==
|
1324
1319
|
oldList[index].loadingAnimView.animUrl
|
1325
1320
|
) {
|
1326
|
-
console.log(
|
1327
|
-
'检测到loadingAnimView.animUrl变化:',
|
1328
|
-
item.loadingAnimView.animUrl
|
1329
|
-
);
|
1330
1321
|
this.$nextTick(() => {
|
1331
1322
|
const itemId = item.itemView.id;
|
1332
1323
|
if (this.lottieAnimations[`loading-${itemId}`]) {
|
@@ -1348,10 +1339,6 @@ export default {
|
|
1348
1339
|
oldList[index].frontAnimView &&
|
1349
1340
|
item.frontAnimView.animUrl !== oldList[index].frontAnimView.animUrl
|
1350
1341
|
) {
|
1351
|
-
console.log(
|
1352
|
-
'检测到frontAnimView.animUrl变化:',
|
1353
|
-
item.frontAnimView.animUrl
|
1354
|
-
);
|
1355
1342
|
this.$nextTick(() => {
|
1356
1343
|
const itemId = item.itemView.id;
|
1357
1344
|
if (this.lottieAnimations[`front-${itemId}`]) {
|
@@ -1370,6 +1357,20 @@ export default {
|
|
1370
1357
|
},
|
1371
1358
|
deep: true,
|
1372
1359
|
},
|
1360
|
+
// 添加对编辑状态的监听
|
1361
|
+
'data.isEditing': {
|
1362
|
+
handler(newValue) {
|
1363
|
+
const elements = this.findParentElements();
|
1364
|
+
if (elements.refresh) {
|
1365
|
+
if (newValue) {
|
1366
|
+
elements.refresh.style.maxHeight = '0px';
|
1367
|
+
} else {
|
1368
|
+
elements.refresh.style.maxHeight = '999px'
|
1369
|
+
}
|
1370
|
+
}
|
1371
|
+
},
|
1372
|
+
immediate: true
|
1373
|
+
},
|
1373
1374
|
},
|
1374
1375
|
mounted() {
|
1375
1376
|
console.log(this.data, 'djdjdjdjdjdjdj');
|
@@ -1378,6 +1379,8 @@ export default {
|
|
1378
1379
|
// 获取并存储固定宽高
|
1379
1380
|
this.updateFixedItemSize();
|
1380
1381
|
|
1382
|
+
this.searchDom()
|
1383
|
+
|
1381
1384
|
// 监听窗口大小变化,更新grid-box宽度
|
1382
1385
|
window.addEventListener('resize', () => {
|
1383
1386
|
this.updateGridBoxWidth();
|
@@ -1411,7 +1414,6 @@ export default {
|
|
1411
1414
|
Object.keys(this.lottieAnimations).forEach((key) => {
|
1412
1415
|
const anim = this.lottieAnimations[key];
|
1413
1416
|
if (anim && typeof anim.destroy === 'function') {
|
1414
|
-
console.log(`组件销毁时清理动画: ${key}`);
|
1415
1417
|
try {
|
1416
1418
|
anim.removeEventListener('complete');
|
1417
1419
|
anim.removeEventListener('DOMLoaded');
|
@@ -1419,7 +1421,6 @@ export default {
|
|
1419
1421
|
anim.removeEventListener('loaded_images');
|
1420
1422
|
anim.removeEventListener('loopComplete');
|
1421
1423
|
} catch (e) {
|
1422
|
-
console.warn(`移除事件监听器失败: ${e.message}`);
|
1423
1424
|
}
|
1424
1425
|
anim.destroy();
|
1425
1426
|
}
|
package/src/transform-loader.js
CHANGED