Skip to content

IntersectionObserver mpx.createIntersectionObserver(Object component, Object options)

创建并返回一个 IntersectionObserver 对象实例。在自定义组件或包含自定义组件的页面中,应使用 this.createIntersectionObserver([options]) 来代替。

支持情况: 微信、支付宝、web、RN

参考文档

参数

Object component

自定义组件实例

Object options

选项

属性类型默认值必填说明最低版本
thresholdsArray.<number>[0]一个数值数组,包含所有阈值。
initialRationumber0初始的相交比例,如果调用时检测到的相交比例与这个值不相等且达到阈值,则会触发一次监听器的回调函数。
observeAllbooleanfalse是否同时观测多个目标节点(而非一个),如果设为 true ,observe 的 targetSelector 将选中多个节点(注意:同时选中过多节点将影响渲染性能)2.0.0
nativeModebooleanfalse是否使用原生观察器模式。3.5.7

返回值

IntersectionObserver