@dolphinweex/weex-harmony 0.1.24 → 0.1.25

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.24",
3
+ "version": "0.1.25",
4
4
  "description": "weex harmony adapter",
5
5
  "main": "index.js",
6
6
  "files": [
@@ -260,10 +260,6 @@ export default {
260
260
  const oldVisibility = this.processedList[index].actionButton.visibility;
261
261
  const newVisibility = data.actionButton.visibility;
262
262
 
263
- if (typeof newVisibility === 'number') {
264
- console.log(`按钮可见性从 ${oldVisibility} 变更为 ${newVisibility}`);
265
- }
266
-
267
263
  // 检查是否有动画URL的变化
268
264
  const oldBgAnimUrl = this.processedList[index].bgAnimView.animUrl || '';
269
265
  const oldLoadingAnimUrl =
@@ -292,7 +288,6 @@ export default {
292
288
 
293
289
  // 如果动画URL有变化,重新初始化相关的Lottie动画
294
290
  if (hasAnimUrlChanged) {
295
- console.log('检测到动画URL变化,重新初始化动画');
296
291
 
297
292
  // 等待下一帧DOM更新完成后再操作
298
293
  this.$nextTick(() => {
@@ -307,7 +302,6 @@ export default {
307
302
  ];
308
303
  animKeys.forEach((key) => {
309
304
  if (this.lottieAnimations[key]) {
310
- console.log(`销毁动画实例: ${key}`);
311
305
  const anim = this.lottieAnimations[key];
312
306
  try {
313
307
  anim.removeEventListener('complete');
@@ -316,14 +310,12 @@ export default {
316
310
  anim.removeEventListener('loaded_images');
317
311
  anim.removeEventListener('loopComplete');
318
312
  } catch (e) {
319
- console.warn(`移除事件监听器失败: ${e.message}`);
320
313
  }
321
314
  anim.destroy();
322
315
  delete this.lottieAnimations[key];
323
316
  }
324
317
  });
325
318
 
326
- console.log('清理完成,开始重新初始化动画');
327
319
 
328
320
  // 延迟一点时间确保DOM完全更新
329
321
  setTimeout(() => {
@@ -372,7 +364,6 @@ export default {
372
364
  callback({ listData: data });
373
365
  },
374
366
  rightIconClick(e) {
375
- console.log('rightIconClick执行,阻止事件冒泡');
376
367
  e.preventDefault();
377
368
  e.stopPropagation();
378
369
  this.$emit('onClickRightIcon', e);
@@ -406,7 +397,6 @@ export default {
406
397
  }
407
398
  e.preventDefault();
408
399
  e.stopPropagation();
409
- console.log('itemViewClick');
410
400
  // 确保取消任何长按计时器
411
401
  this.cancelLongPress();
412
402
  if (this.data.isEditing) {
@@ -424,7 +414,6 @@ export default {
424
414
  },
425
415
 
426
416
  actionClick(e, item, index) {
427
- console.log('actionClick执行,阻止事件冒泡');
428
417
  e.preventDefault();
429
418
  e.stopPropagation(); // 阻止事件冒泡到itemViewClick
430
419
 
@@ -443,14 +432,12 @@ export default {
443
432
 
444
433
  // 新增方法:清理除指定项目外的所有动画实例
445
434
  cleanupOtherAnimations(currentItemId) {
446
- console.log('清理其他项目的动画实例,当前项目ID:', currentItemId);
447
435
 
448
436
  // 遍历所有动画实例
449
437
  Object.keys(this.lottieAnimations).forEach((key) => {
450
438
  // 检查是否为其他项目的动画
451
439
  if (!key.includes(`-${currentItemId}`)) {
452
440
  if (this.lottieAnimations[key]) {
453
- console.log(`销毁其他项目的动画实例: ${key}`);
454
441
  const anim = this.lottieAnimations[key];
455
442
 
456
443
  // 移除所有事件监听器
@@ -479,7 +466,6 @@ export default {
479
466
  const animContainer =
480
467
  this.$refs[refName] && this.$refs[refName][0];
481
468
  if (animContainer) {
482
- console.log(`隐藏动画容器: ${refName}`);
483
469
  animContainer.style.display = 'none';
484
470
  }
485
471
  });
@@ -523,7 +509,6 @@ export default {
523
509
  },
524
510
  getItemStyle(item, type) {
525
511
  const result = this.mergeDate(item[type] || {}, type);
526
- console.log(type, this.applyNormalAttribute(result), 'ggg');
527
512
  return this.applyNormalAttribute(result);
528
513
  },
529
514
  mergeDate(target, type) {
@@ -599,7 +584,6 @@ export default {
599
584
  const touch = e.changedTouches[0];
600
585
  this.touchStartX = touch.pageX;
601
586
  this.touchStartY = touch.pageY;
602
- console.log('开始长按ddddddddd', touch, touch.pageY, touch.pageX);
603
587
  this.longPressStartIndex = index;
604
588
  this.isScrolling = false; // 重置滚动状态
605
589
 
@@ -616,9 +600,7 @@ export default {
616
600
  items: [...this.itemsList],
617
601
  });
618
602
  }
619
- console.log(
620
- `准备长按: index=${index}, 触摸坐标=(${touch.pageX}, ${touch.pageY})`
621
- );
603
+
622
604
 
623
605
  // 设置新的长按计时器
624
606
  this.longPressTimer = setTimeout(() => {
@@ -977,12 +959,6 @@ export default {
977
959
  // 为每个列表项初始化动画
978
960
  this.processedList.forEach((item) => {
979
961
  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
962
  // 加载背景动画
987
963
  this.loadLottieAnimation(
988
964
  item.bgAnimView,
@@ -1014,27 +990,17 @@ export default {
1014
990
  // 抽取公共的loadLottieAnimation方法
1015
991
  loadLottieAnimation(animView, refName, animKey, item) {
1016
992
  if (!animView || !animView.animUrl) {
1017
- console.log(`[${animKey}] 跳过加载:animUrl不存在`);
1018
993
  return;
1019
994
  }
1020
995
 
1021
- console.log(
1022
- `[${animKey}] 尝试初始化${refName}, animUrl:`,
1023
- animView.animUrl,
1024
- '可见性:',
1025
- animView.visibility
1026
- );
1027
-
1028
996
  const animEl = this.$refs[refName];
1029
997
  if (!animEl || !animEl[0]) {
1030
- console.warn(`[${animKey}] 未找到${refName}的DOM引用,请检查DOM结构`);
1031
998
  return;
1032
999
  }
1033
1000
 
1034
1001
  try {
1035
1002
  // 如果已经有实例,先销毁它
1036
1003
  if (this.lottieAnimations[animKey]) {
1037
- console.log(`[${animKey}] 销毁现有的动画实例`);
1038
1004
  this.lottieAnimations[animKey].destroy();
1039
1005
  delete this.lottieAnimations[animKey];
1040
1006
  }
@@ -1045,33 +1011,21 @@ export default {
1045
1011
  animView.visibility !== 0
1046
1012
  ) {
1047
1013
  // 使用fetch方式获取动画数据
1048
- console.log(`[${animKey}] 开始获取动画数据:`, animView.animUrl);
1049
1014
  fetch(animView.animUrl)
1050
1015
  .then((response) => {
1051
1016
  if (!response.ok) {
1052
- console.error(
1053
- `[${animKey}] 获取动画数据失败,HTTP状态码:`,
1054
- response.status
1055
- );
1056
1017
  throw new Error('Network response was not ok');
1057
1018
  }
1058
- console.log(`[${animKey}] 网络请求成功,正在解析JSON`);
1059
1019
  return response.json();
1060
1020
  })
1061
1021
  .then((animationData) => {
1062
- console.log(
1063
- `[${animKey}] 动画数据已加载,数据大小:`,
1064
- JSON.stringify(animationData).length
1065
- );
1066
1022
  // 再次检查是否已有实例(可能在fetch期间创建了)
1067
1023
  if (this.lottieAnimations[animKey]) {
1068
- console.log(`[${animKey}] 销毁fetch期间创建的动画实例`);
1069
1024
  this.lottieAnimations[animKey].destroy();
1070
1025
  delete this.lottieAnimations[animKey];
1071
1026
  }
1072
1027
 
1073
1028
  // 创建新的动画实例
1074
- console.log(`[${animKey}] 创建新的动画实例`);
1075
1029
  const anim = lottie.loadAnimation({
1076
1030
  container: animEl[0],
1077
1031
  renderer: 'svg',
@@ -1087,15 +1041,10 @@ export default {
1087
1041
  this.lottieAnimations[animKey] = anim;
1088
1042
 
1089
1043
  // 添加动画事件监听
1090
- anim.addEventListener('DOMLoaded', () => {
1091
- console.log(`[${animKey}] 动画DOM已加载完成`);
1092
- });
1093
1044
 
1094
1045
  anim.addEventListener('complete', () => {
1095
- console.log(`[${animKey}] 动画播放完成一次`);
1096
1046
  // 检查是否需要销毁动画(非循环动画完成后销毁)
1097
1047
  if (!item.animRepeatCount) {
1098
- console.log(`[${animKey}] 非循环动画播放完成,执行销毁`);
1099
1048
  // 销毁前再次检查实例是否存在
1100
1049
  if (this.lottieAnimations[animKey] === anim) {
1101
1050
  anim.removeEventListener('complete');
@@ -1105,7 +1054,6 @@ export default {
1105
1054
  anim.removeEventListener('loopComplete');
1106
1055
  anim.destroy();
1107
1056
  delete this.lottieAnimations[animKey];
1108
- console.log(`[${animKey}] 动画实例已销毁`);
1109
1057
 
1110
1058
  // 查找并隐藏对应的动画容器
1111
1059
  this.$nextTick(() => {
@@ -1174,23 +1122,17 @@ export default {
1174
1122
  );
1175
1123
  }
1176
1124
  }
1177
- console.log(`[${animKey}] 已清空动画URL数据`);
1178
1125
  }
1179
1126
  });
1180
1127
  }
1181
1128
  }
1182
1129
  });
1183
1130
 
1184
- console.log(`[${animKey}] ${refName}初始化成功`);
1185
1131
  })
1186
1132
  .catch((error) => {
1187
- console.error(`[${animKey}] 加载${refName}动画数据失败:`, error);
1188
1133
  });
1189
- } else {
1190
- console.log(`[${animKey}] ${refName}可见性为0,跳过初始化`);
1191
- }
1134
+ }
1192
1135
  } catch (error) {
1193
- console.error(`[${animKey}] ${refName}初始化失败,详细错误:`, error);
1194
1136
  }
1195
1137
  },
1196
1138
 
@@ -1202,18 +1144,12 @@ export default {
1202
1144
  const rect = gridItem.getBoundingClientRect();
1203
1145
  this.fixedItemWidth = rect.width;
1204
1146
  this.fixedItemHeight = rect.height;
1205
- console.log(
1206
- '固定宽高已更新:',
1207
- this.fixedItemWidth,
1208
- this.fixedItemHeight
1209
- );
1210
1147
  }
1211
1148
  });
1212
1149
  },
1213
1150
 
1214
1151
  // 暂未使用,但保留用于将来扩展
1215
1152
  leftTopIconClick(e) {
1216
- console.log('leftTopIconClick执行,阻止事件冒泡');
1217
1153
  e.preventDefault();
1218
1154
  e.stopPropagation();
1219
1155
  // 这里可以添加将来的处理逻辑
@@ -1233,21 +1169,8 @@ export default {
1233
1169
  // 监听列表数据变化,自动更新处理后的数据
1234
1170
  'data.list': {
1235
1171
  handler(newList, oldList) {
1236
- console.log('检测到data.list变化');
1237
1172
  this.processedList = this.generateDataList();
1238
1173
  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
1174
  this.updateGridBoxWidth();
1252
1175
  this.updateFixedItemSize();
1253
1176
  this.initLottieAnimations();
@@ -1297,10 +1220,6 @@ export default {
1297
1220
  oldList[index].bgAnimView &&
1298
1221
  item.bgAnimView.animUrl !== oldList[index].bgAnimView.animUrl
1299
1222
  ) {
1300
- console.log(
1301
- '检测到bgAnimView.animUrl变化:',
1302
- item.bgAnimView.animUrl
1303
- );
1304
1223
  this.$nextTick(() => {
1305
1224
  const itemId = item.itemView.id;
1306
1225
  if (this.lottieAnimations[`bg-${itemId}`]) {
@@ -1323,10 +1242,6 @@ export default {
1323
1242
  item.loadingAnimView.animUrl !==
1324
1243
  oldList[index].loadingAnimView.animUrl
1325
1244
  ) {
1326
- console.log(
1327
- '检测到loadingAnimView.animUrl变化:',
1328
- item.loadingAnimView.animUrl
1329
- );
1330
1245
  this.$nextTick(() => {
1331
1246
  const itemId = item.itemView.id;
1332
1247
  if (this.lottieAnimations[`loading-${itemId}`]) {
@@ -1348,10 +1263,6 @@ export default {
1348
1263
  oldList[index].frontAnimView &&
1349
1264
  item.frontAnimView.animUrl !== oldList[index].frontAnimView.animUrl
1350
1265
  ) {
1351
- console.log(
1352
- '检测到frontAnimView.animUrl变化:',
1353
- item.frontAnimView.animUrl
1354
- );
1355
1266
  this.$nextTick(() => {
1356
1267
  const itemId = item.itemView.id;
1357
1268
  if (this.lottieAnimations[`front-${itemId}`]) {
@@ -1411,7 +1322,6 @@ export default {
1411
1322
  Object.keys(this.lottieAnimations).forEach((key) => {
1412
1323
  const anim = this.lottieAnimations[key];
1413
1324
  if (anim && typeof anim.destroy === 'function') {
1414
- console.log(`组件销毁时清理动画: ${key}`);
1415
1325
  try {
1416
1326
  anim.removeEventListener('complete');
1417
1327
  anim.removeEventListener('DOMLoaded');
@@ -1419,7 +1329,6 @@ export default {
1419
1329
  anim.removeEventListener('loaded_images');
1420
1330
  anim.removeEventListener('loopComplete');
1421
1331
  } catch (e) {
1422
- console.warn(`移除事件监听器失败: ${e.message}`);
1423
1332
  }
1424
1333
  anim.destroy();
1425
1334
  }
@@ -343,6 +343,10 @@ module.exports = function (source) {
343
343
  script,
344
344
  styles
345
345
  } = moduleResoveRet
346
+ if (!template) {
347
+ return source
348
+ }
349
+
346
350
  const tempAst = parse(template.content)
347
351
  tempAst.forEach((node) => {
348
352
  traverseNode(node)