beforeDestroy() {
if (this.IntersectionObserver) {
this.IntersectionObserver.disconnect();
}
},
methods: {
ObserverCallback(entrys) {
entrys.forEach(entry => {
console.log(44, entrys);
if (!entry.isIntersecting) return;
//加载更多 ,请求
});
},
addObserver() {
try {
let rootDom = document.getElementById('msgInfoPC');
let lMoreDom = document.querySelector('.ynpc-load-more');
if (!rootDom || !lMoreDom) return;
setTimeout(() => {
let options = {
root: rootDom,
rootMargin: '0px 0px 50px 0px',
thresholds: 0
};
this.IntersectionObserver = new IntersectionObserver(this.ObserverCallback, options);
//监听最底部的loadmore是否出现
this.IntersectionObserver.observe(lMoreDom);
console.log('lsit');
}, 300);
} catch (error) {}
},
handleMsgShowInfoByPC(obj) {
this.getNotificationsType(obj.type);
setTimeout(() => {
this.setNotiRead(obj.type);
}, 1000);
},
}