@dolphinweex/weex-harmony 0.1.90 → 0.1.91

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.90",
3
+ "version": "0.1.91",
4
4
  "description": "weex harmony adapter",
5
5
  "main": "index.js",
6
6
  "files": [
@@ -350,43 +350,24 @@ export default {
350
350
  this.debugLog(`计算得到elementHeight=${elementHeight}px`);
351
351
 
352
352
  if (elementHeight > 0) {
353
- // 默认不按当前视口剩余高度裁剪,避免可滚动页面中 iframe 被错误截断。
354
- // plugin-menu 页面保持原有“限制在可视区”策略。
353
+ // isPluginMenu=false:始终不按视口裁剪,保持原逻辑不变。
354
+ // isPluginMenu=true:改为不裁剪,避免多组件时下方 iframe 被裁成一条线、且裁剪值同步到父级压扁整块。
355
355
  let maxHeight = Number.POSITIVE_INFINITY;
356
- this.debugLog(`初始maxHeight=${maxHeight}px (isPluginMenu=${this.isPluginMenu})`);
357
-
358
356
  if (this.isPluginMenu) {
359
- maxHeight = window.innerHeight;
360
- if (this.$refs.iframe) {
361
- try {
362
- const rect = this.$refs.iframe.getBoundingClientRect();
363
- this.debugLog(`iframe位置: top=${rect.top}, left=${rect.left}, width=${rect.width}, height=${rect.height}`);
364
- if (rect.top > 0) {
365
- maxHeight = window.innerHeight - rect.top;
366
- this.debugLog(`plugin-menu 调整后maxHeight=${maxHeight}px (top=${rect.top})`);
367
- }
368
- } catch (e) {
369
- this.debugWarn('获取 iframe 位置失败:', e);
370
- }
371
- } else {
372
- this.debugWarn(`this.$refs.iframe 不存在`);
373
- }
374
- maxHeight = Math.max(maxHeight, 0);
357
+ maxHeight = Number.POSITIVE_INFINITY; // 仅对 plugin-menu 取消视口裁剪,不影响 isPluginMenu=false
375
358
  }
376
-
377
- this.debugLog(`最终maxHeight=${maxHeight}px`);
359
+ this.debugLog(`maxHeight=${maxHeight} (isPluginMenu=${this.isPluginMenu})`);
378
360
 
379
- // 非 plugin-menu 不裁剪;plugin-menu 才按 maxHeight 限制
380
361
  const finalHeight = elementHeight > maxHeight ? maxHeight : elementHeight;
381
- this.debugLog(`finalHeight=${finalHeight}px (isPluginMenu=${this.isPluginMenu}, elementHeight=${elementHeight}, maxHeight=${maxHeight})`);
362
+ this.debugLog(`finalHeight=${finalHeight}px (elementHeight=${elementHeight}, maxHeight=${maxHeight})`);
382
363
 
383
364
  // 更新 iframe 高度(考虑 weex scale)
384
365
  const scale = weex.config.env.scale || 1;
385
366
  let newHeightValue = finalHeight / scale;
386
367
 
387
368
  // 父级有 style 设置的高度时:若 iframe 计算高度偏小,直接用父级高度
388
- // newHeightValue 单位:Weex 虚拟 px;父级 getBoundingClientRect 单位:CSS px
389
- // 两者转换关系:CSS px = Weex vp * scale,所以 Weex vp = CSS px / scale
369
+ // 关键:直接解析 inline style 字符串(rem/px),而不用 getBoundingClientRect
370
+ // 避免因为内容撑大或旧代码写入导致取到错误的"当前渲染高度"
390
371
  if (this._wrapperEl) {
391
372
  try {
392
373
  const inlineHeight = this._wrapperEl.style && this._wrapperEl.style.height;
@@ -411,7 +392,7 @@ export default {
411
392
  this.debugLog(`计算newHeight=${newHeight} (finalHeight=${finalHeight}, scale=${scale}), 当前height=${this.height}`);
412
393
  if (this.height !== newHeight) {
413
394
  this.height = newHeight;
414
- this.debugLog(`✅ iframe 高度已更新: ${finalHeight}px -> ${newHeight} (embedId: ${this.embedId}, max: ${maxHeight}px)`);
395
+ this.debugLog(`✅ iframe 高度已更新: ${finalHeight}px -> ${newHeight} (embedId: ${this.embedId})`);
415
396
  } else {
416
397
  this.debugLog(`⚠️ 高度未变化,不更新 (当前=${this.height}, 新值=${newHeight})`);
417
398
  }