@dolphinweex/weex-harmony 0.1.95 → 0.1.98
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
|
@@ -39,9 +39,13 @@ props: {
|
|
|
39
39
|
type: Object,
|
|
40
40
|
required: false,
|
|
41
41
|
},
|
|
42
|
-
|
|
42
|
+
onMessage: {
|
|
43
43
|
type: Function,
|
|
44
44
|
default: () => {}
|
|
45
|
+
},
|
|
46
|
+
interceptUrls:{
|
|
47
|
+
type: Array,
|
|
48
|
+
default: () => []
|
|
45
49
|
}
|
|
46
50
|
},
|
|
47
51
|
|
|
@@ -57,6 +61,7 @@ computed: {
|
|
|
57
61
|
error: this.onError,
|
|
58
62
|
receivedtitle: this.onReceivedTitle,
|
|
59
63
|
message: this.onMessage,
|
|
64
|
+
interceptUrls: this.interceptUrls
|
|
60
65
|
}
|
|
61
66
|
}
|
|
62
67
|
},
|
|
@@ -246,6 +246,63 @@ export default {
|
|
|
246
246
|
return height;
|
|
247
247
|
},
|
|
248
248
|
|
|
249
|
+
isSafeHeightFallbackTarget(el, scroller) {
|
|
250
|
+
if (!el || !scroller) return false;
|
|
251
|
+
if (el === scroller) return false;
|
|
252
|
+
if (!scroller.contains(el)) return false;
|
|
253
|
+
if (!el.children || el.children.length === 0) return false;
|
|
254
|
+
|
|
255
|
+
const className = `${el.className || ''}`;
|
|
256
|
+
const unsafeKeywords = ['weex-scroller-inner', 'weex-waterfall-inner', 'weex-waterfall-inner-columns'];
|
|
257
|
+
if (unsafeKeywords.some(keyword => className.includes(keyword))) {
|
|
258
|
+
this.debugWarn(`fallback 目标命中不安全关键字,放弃使用: ${className}`);
|
|
259
|
+
return false;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
const firstChild = el.children[0];
|
|
263
|
+
if (!firstChild) return false;
|
|
264
|
+
|
|
265
|
+
const firstChildClassName = `${firstChild.className || ''}`;
|
|
266
|
+
if (firstChildClassName.includes('weex-root')) {
|
|
267
|
+
this.debugLog(`fallback 目标首子节点已是 weex-root,可安全使用: ${className}`);
|
|
268
|
+
return true;
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
if (el.children.length === 1) {
|
|
272
|
+
this.debugLog(`fallback 目标仅有一个子节点,允许临时使用: ${className}`);
|
|
273
|
+
return true;
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
this.debugWarn(`fallback 目标存在多个子节点且无 weex-root 标识,放弃使用: ${className}`);
|
|
277
|
+
return false;
|
|
278
|
+
},
|
|
279
|
+
|
|
280
|
+
findWeexHeightTarget(doc) {
|
|
281
|
+
if (!doc) return null;
|
|
282
|
+
const globalRoot = doc.querySelector('.weex-root');
|
|
283
|
+
const scroller = doc.querySelector('.weex-scroller-inner');
|
|
284
|
+
if (scroller) {
|
|
285
|
+
this.debugLog(`找到 .weex-scroller-inner`);
|
|
286
|
+
const scrollerRoot = scroller.querySelector('.weex-root');
|
|
287
|
+
if (scrollerRoot) {
|
|
288
|
+
this.debugLog(`在 .weex-scroller-inner 内找到 .weex-root`);
|
|
289
|
+
return scrollerRoot;
|
|
290
|
+
}
|
|
291
|
+
const fallbackTarget = scroller.children && scroller.children[0];
|
|
292
|
+
if (this.isSafeHeightFallbackTarget(fallbackTarget, scroller)) {
|
|
293
|
+
this.debugLog(`使用安全 fallback 容器: ${fallbackTarget.className || fallbackTarget.tagName}`);
|
|
294
|
+
return fallbackTarget;
|
|
295
|
+
}
|
|
296
|
+
this.debugWarn(`.weex-scroller-inner 内未找到可用目标,继续等待`);
|
|
297
|
+
}
|
|
298
|
+
if (globalRoot) {
|
|
299
|
+
this.debugLog(`使用全局 .weex-root`);
|
|
300
|
+
return globalRoot;
|
|
301
|
+
}
|
|
302
|
+
return null;
|
|
303
|
+
},
|
|
304
|
+
|
|
305
|
+
|
|
249
306
|
// 监听 iframe 内容高度变化
|
|
250
307
|
startWeexRootHeightMonitoring() {
|
|
251
308
|
this.debugLog(`startWeexRootHeightMonitoring 开始: embedId=${this.embedId}`);
|
|
@@ -261,17 +318,7 @@ export default {
|
|
|
261
318
|
|
|
262
319
|
try {
|
|
263
320
|
const doc = iframe.contentDocument || iframe.contentWindow.document;
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
// 1. 优先找 weex-scroller-inner 及其内部的 weex-root
|
|
267
|
-
const scroller = doc.querySelector('.weex-scroller-inner');
|
|
268
|
-
if (scroller) {
|
|
269
|
-
this.debugLog(`找到 .weex-scroller-inner`);
|
|
270
|
-
target = scroller.querySelector('.weex-root') || scroller.children[0];
|
|
271
|
-
} else {
|
|
272
|
-
// 2. 备选找全局 weex-root
|
|
273
|
-
target = doc.querySelector('.weex-root');
|
|
274
|
-
}
|
|
321
|
+
const target = this.findWeexHeightTarget(doc);
|
|
275
322
|
|
|
276
323
|
if (!target) {
|
|
277
324
|
if (attempts >= maxAttempts) {
|
|
@@ -353,16 +400,8 @@ export default {
|
|
|
353
400
|
this.debugLog(`计算得到elementHeight=${elementHeight}px`);
|
|
354
401
|
|
|
355
402
|
if (elementHeight > 0) {
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
let maxHeight = Number.POSITIVE_INFINITY;
|
|
359
|
-
if (this.isPluginMenu) {
|
|
360
|
-
maxHeight = Number.POSITIVE_INFINITY; // 仅对 plugin-menu 取消视口裁剪,不影响 isPluginMenu=false
|
|
361
|
-
}
|
|
362
|
-
this.debugLog(`maxHeight=${maxHeight} (isPluginMenu=${this.isPluginMenu})`);
|
|
363
|
-
|
|
364
|
-
const finalHeight = elementHeight > maxHeight ? maxHeight : elementHeight;
|
|
365
|
-
this.debugLog(`finalHeight=${finalHeight}px (elementHeight=${elementHeight}, maxHeight=${maxHeight})`);
|
|
403
|
+
const finalHeight = elementHeight;
|
|
404
|
+
this.debugLog(`finalHeight=${finalHeight}px (elementHeight=${elementHeight})`);
|
|
366
405
|
|
|
367
406
|
// 更新 iframe 高度(考虑 weex scale)
|
|
368
407
|
const scale = weex.config.env.scale || 1;
|
package/src/index.js
CHANGED
|
@@ -230,6 +230,11 @@ const componentMap = [
|
|
|
230
230
|
componentAddress: 'midea-ipc-drag-list-view.vue',
|
|
231
231
|
isInPlugin: false
|
|
232
232
|
},
|
|
233
|
+
{
|
|
234
|
+
componentName: 'mideaAudioInputView',
|
|
235
|
+
componentAddress: 'midea-audio-input-view',
|
|
236
|
+
isInPlugin: false
|
|
237
|
+
},
|
|
233
238
|
]
|
|
234
239
|
|
|
235
240
|
module.exports = componentMap
|