Closed chenqiushi closed 5 years ago
图片不显示原因是:
在加载页面时部分 mip-img 不在视口中,没有进行渲染
iframe 滚动没有触发 scroll 事件,导致没有执行viewportCallback
有两个解决方法:
mip-img 新增 prerender 属性,即使不在视口中也渲染
iframe scrolling 设为 yes,iframe height 设为小于内容高度,如 window.innerHeight,就能够触发 scroll 事件
BUG 描述 清晰和准确的描述 Bug 是什么
开发者反馈,在 iframe 中使用 mip 站点页面,需求是待 onload 后再动态赋值 iframe 高度进行自适应,发现该页面的图片组件不会展示。
分析应该是 iframe 没有初始高度,导致 mip-img 组件的 viewportCallback/layoutCallback 生命周期没执行。
这种 case,我们是否需要提供比较合理的解决办法?
复现步骤
可复现的代码:
期望结果 清晰和准确的描述你期望的结果
截图 如果合适,添加问题相关的截图
环境及版本信息:
其他信息 其他补充信息