fix: update observer callback

This commit is contained in:
Gabe Yuan
2024-03-27 14:24:41 +08:00
parent ec6a49f01e
commit dc3c510d57

View File

@@ -58,11 +58,11 @@ export class Translator {
// 显示 // 显示
_interseObserver = new IntersectionObserver( _interseObserver = new IntersectionObserver(
(intersections) => { (entries, observer) => {
intersections.forEach((intersection) => { entries.forEach((entry) => {
if (intersection.isIntersecting) { if (entry.isIntersecting) {
this._render(intersection.target); observer.unobserve(entry.target);
this._interseObserver.unobserve(intersection.target); this._render(entry.target);
} }
}); });
}, },