@dolphinweex/weex-harmony 0.1.33 → 0.1.34

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.33",
3
+ "version": "0.1.34",
4
4
  "description": "weex harmony adapter",
5
5
  "main": "index.js",
6
6
  "files": [
package/src/.DS_Store ADDED
Binary file
Binary file
@@ -167,13 +167,11 @@ export default {
167
167
  },
168
168
  data() {
169
169
  return {
170
- isNotUpdated: true,
171
170
  targetTouchX: 0,
172
171
  targetTouchY: 0,
173
172
  selected: null,
174
173
  longPressTimer: null,
175
174
  longPressDuration: 350,
176
- longPressStartIndex: null,
177
175
  draggingIndex: null,
178
176
  hoverIndex: null,
179
177
  isTouchDragging: false,
@@ -285,12 +283,6 @@ export default {
285
283
  const animKey = `${type}-${itemId}`;
286
284
  const refName = `${type}Anim-${itemId}`;
287
285
 
288
- // 销毁旧动画
289
- if (this.lottieAnimations[animKey]) {
290
- this.lottieAnimations[animKey].destroy();
291
- delete this.lottieAnimations[animKey];
292
- }
293
-
294
286
  // 检查DOM元素是否存在
295
287
  const animEl = this.$refs[refName];
296
288
  if (!animEl || !animEl[0] || !animView.animUrl) {
@@ -305,6 +297,36 @@ export default {
305
297
  return;
306
298
  }
307
299
 
300
+ // 如果是bg或front动画,需要检查并清理另一个
301
+ if (type === 'bg' || type === 'front') {
302
+ const otherType = type === 'bg' ? 'front' : 'bg';
303
+ const otherAnimKey = `${otherType}-${itemId}`;
304
+
305
+ // 如果另一个动画正在运行,先销毁它
306
+ if (this.lottieAnimations[otherAnimKey]) {
307
+ this.lottieAnimations[otherAnimKey].destroy();
308
+ delete this.lottieAnimations[otherAnimKey];
309
+
310
+ // 清空对应的animUrl数据
311
+ const index = this.data.list.findIndex(
312
+ (i) => i.itemView.id == itemId
313
+ );
314
+ if (index !== -1) {
315
+ this.$set(
316
+ this.data.list[index][`${otherType}AnimView`],
317
+ 'animUrl',
318
+ ''
319
+ );
320
+ }
321
+ }
322
+ }
323
+
324
+ // 销毁当前类型的旧动画
325
+ if (this.lottieAnimations[animKey]) {
326
+ this.lottieAnimations[animKey].destroy();
327
+ delete this.lottieAnimations[animKey];
328
+ }
329
+
308
330
  try {
309
331
  const anim = lottie.loadAnimation({
310
332
  container: animEl[0],
@@ -595,7 +617,6 @@ export default {
595
617
  return;
596
618
  }
597
619
  this.$emit('onDragEventStart', e);
598
-
599
620
  // 只在编辑模式下阻止事件冒泡和默认行为
600
621
  this.cancelLongPress();
601
622
  // 记录起始触摸位置和索引
@@ -603,7 +624,6 @@ export default {
603
624
  this.touchStartX = touch.pageX;
604
625
  this.touchStartY = touch.pageY;
605
626
  console.log('开始长按ddddddddd', touch, touch.pageY, touch.pageX);
606
- this.longPressStartIndex = index;
607
627
  this.isScrolling = false; // 重置滚动状态
608
628
 
609
629
  // 设置新的长按计时器
@@ -707,7 +727,6 @@ export default {
707
727
  clearTimeout(this.longPressTimer);
708
728
  this.longPressTimer = null;
709
729
  }
710
- this.longPressStartIndex = null;
711
730
  },
712
731
 
713
732
  // 触摸移动处理
@@ -940,10 +959,10 @@ export default {
940
959
  watch: {
941
960
  'data.isEditing': {
942
961
  handler(newVal) {
943
- this.isNotUpdated = newVal
944
- if (!newVal) {
945
- this.$set(this.data, 'list', this.data.list);
946
- }
962
+ this.generateDataList();
963
+ this.$nextTick(() => {
964
+ this.initLottieAnimations();
965
+ });
947
966
  },
948
967
  deep: true,
949
968
  },
@@ -954,12 +973,13 @@ export default {
954
973
  if (this.isProcessingData) {
955
974
  return;
956
975
  }
957
-
958
- console.log('检测到data.list变化');
959
- this.generateDataList();
960
- this.$nextTick(() => {
961
- this.initLottieAnimations();
962
- });
976
+ if (newList.length !== oldList.length) {
977
+ console.log('检测到data.list变化');
978
+ this.generateDataList();
979
+ this.$nextTick(() => {
980
+ this.initLottieAnimations();
981
+ });
982
+ }
963
983
  },
964
984
  deep: true,
965
985
  },
@@ -974,9 +994,6 @@ export default {
974
994
  // 初始化Lottie动画
975
995
  this.initLottieAnimations();
976
996
  },
977
- updated(){
978
- if(this.isNotUpdated){return}
979
- },
980
997
  beforeDestroy() {
981
998
  // 确保清理所有事件监听器
982
999
  this.cancelLongPress();
@@ -997,10 +1014,12 @@ export default {
997
1014
  button {
998
1015
  border: none;
999
1016
  }
1017
+
1000
1018
  .disabled-item {
1001
1019
  opacity: 0.6;
1002
1020
  pointer-events: none;
1003
1021
  }
1022
+
1004
1023
  .outer-container {
1005
1024
  width: 100%;
1006
1025
  position: relative;
@@ -1035,6 +1054,7 @@ button {
1035
1054
  will-change: transform, opacity, box-shadow;
1036
1055
  overflow: hidden;
1037
1056
  }
1057
+
1038
1058
  .grid-box {
1039
1059
  position: relative;
1040
1060
  display: flex;
@@ -1045,16 +1065,19 @@ button {
1045
1065
  overflow: hidden;
1046
1066
  height: auto;
1047
1067
  }
1068
+
1048
1069
  .leftTopIcon {
1049
1070
  position: fixed;
1050
1071
  left: 0;
1051
1072
  top: 0;
1052
1073
  }
1074
+
1053
1075
  .actionButton {
1054
1076
  display: flex;
1055
1077
  justify-content: center;
1056
1078
  align-items: center;
1057
1079
  }
1080
+
1058
1081
  /* Lottie容器样式 */
1059
1082
  .lottie-container {
1060
1083
  position: absolute;
@@ -1072,6 +1095,7 @@ button {
1072
1095
  width: 100%;
1073
1096
  height: 100%;
1074
1097
  }
1098
+
1075
1099
  .bg-anim,
1076
1100
  .front-anim {
1077
1101
  position: absolute;
@@ -1096,7 +1120,8 @@ button {
1096
1120
  /* 正在拖拽的元素样式 */
1097
1121
  .being-dragged {
1098
1122
  z-index: 10;
1099
- opacity: 0.3; /* 降低原位置的不透明度 */
1123
+ opacity: 0.3;
1124
+ /* 降低原位置的不透明度 */
1100
1125
  }
1101
1126
 
1102
1127
  /* 被拖拽时原位置隐藏 */
@@ -1120,6 +1145,7 @@ button {
1120
1145
  left: 0;
1121
1146
  top: 0;
1122
1147
  }
1148
+
1123
1149
  .flexBox {
1124
1150
  display: flex;
1125
1151
  justify-content: space-between;
@@ -1127,6 +1153,7 @@ button {
1127
1153
  position: relative;
1128
1154
  flex-direction: row;
1129
1155
  }
1156
+
1130
1157
  .itemText {
1131
1158
  display: block;
1132
1159
  width: 80%;
@@ -1145,15 +1172,19 @@ button {
1145
1172
  0% {
1146
1173
  transform: rotateZ(2deg);
1147
1174
  }
1175
+
1148
1176
  25% {
1149
1177
  transform: rotateZ(-2deg);
1150
1178
  }
1179
+
1151
1180
  50% {
1152
1181
  transform: rotateZ(2deg);
1153
1182
  }
1183
+
1154
1184
  75% {
1155
1185
  transform: rotateZ(-2deg);
1156
1186
  }
1187
+
1157
1188
  100% {
1158
1189
  transform: rotateZ(2deg);
1159
1190
  }