📅  最后修改于: 2022-03-11 14:56:22.184000             🧑  作者: Mango
// Create the observer
this.observer = new IntersectionObserver((entries) => {
entries.forEach((entry: any) => {
if(entry.isIntersecting){
// do something if intersecting
} else {
// do something if not intersecting
}
})
});
// Use the observer on specific elements
this.items.forEach(item => {
this.observer.observe(item.nativeElement);
});