1. beforeDestroy() {
    2. if (this.IntersectionObserver) {
    3. this.IntersectionObserver.disconnect();
    4. }
    5. },
    6. methods: {
    7. ObserverCallback(entrys) {
    8. entrys.forEach(entry => {
    9. console.log(44, entrys);
    10. if (!entry.isIntersecting) return;
    11. //加载更多 ,请求
    12. });
    13. },
    14. addObserver() {
    15. try {
    16. let rootDom = document.getElementById('msgInfoPC');
    17. let lMoreDom = document.querySelector('.ynpc-load-more');
    18. if (!rootDom || !lMoreDom) return;
    19. setTimeout(() => {
    20. let options = {
    21. root: rootDom,
    22. rootMargin: '0px 0px 50px 0px',
    23. thresholds: 0
    24. };
    25. this.IntersectionObserver = new IntersectionObserver(this.ObserverCallback, options);
    26. //监听最底部的loadmore是否出现
    27. this.IntersectionObserver.observe(lMoreDom);
    28. console.log('lsit');
    29. }, 300);
    30. } catch (error) {}
    31. },
    32. handleMsgShowInfoByPC(obj) {
    33. this.getNotificationsType(obj.type);
    34. setTimeout(() => {
    35. this.setNotiRead(obj.type);
    36. }, 1000);
    37. },
    38. }