NodesRef.scrollOffset

    Function callback

    示例

    NodesRef.scrollOffset - 图4

    • 在 swan 文件中
    • 在 js 文件中
    1. appear: false
    2. },
    3. onReady() {
    4. const IntersectionObserver = swan.createIntersectionObserver(this);
    5. IntersectionObserver.relativeTo('.scroll-view').observe('.ball', res => {
    6. this.setData('appear', res.intersectionRatio > 0);
    7. });
    8. this.IntersectionObserver = IntersectionObserver;
    9. getNodeRef() {
    10. const node = swan.createSelectorQuery().select('.scroll-view');
    11. console.log('scrollOffset:::', res);
    12. swan.showModal({
    13. title: 'scrollOffset',
    14. content: JSON.stringify(res)
    15. });
    16. }).exec();
    17. });