Angular 7应用程序中的“Intersection Observer在IE11中冻结”
创始人
2024-10-17 05:00:24
0

在Angular 7应用程序中使用Intersection Observer在IE11中冻结的解决方法是使用polyfill来模拟Intersection Observer的功能。下面是一个解决方案的代码示例:

  1. 安装Intersection Observer的polyfill:
npm install intersection-observer
  1. 在polyfills.ts文件中导入并配置polyfill:
import 'intersection-observer';
  1. 在你的组件中使用Intersection Observer:
import { Component, ElementRef, OnInit, ViewChild } from '@angular/core';

@Component({
  selector: 'app-my-component',
  template: '
My Component
' }) export class MyComponent implements OnInit { @ViewChild('elementRef') elementRef: ElementRef; ngOnInit() { const options = { root: null, rootMargin: '0px', threshold: 1.0 }; const observer = new IntersectionObserver((entries, observer) => { entries.forEach(entry => { if (entry.isIntersecting) { console.log('Element is intersecting'); // Do something when element is intersecting } else { console.log('Element is not intersecting'); // Do something when element is not intersecting } }); }, options); observer.observe(this.elementRef.nativeElement); } }

通过使用Intersection Observer的polyfill,你的Angular 7应用程序中的Intersection Observer在IE11中应该能正常工作。

相关内容

热门资讯

经调查!wepoker免费脚本... 经调查!wepoker免费脚本,潮友会虾蟹骰子概率计算方式,一贯是真的有辅助插件(哔哩哔哩)1、让任...
目前!hhpoker有没有作必... 目前!hhpoker有没有作必弊挂,哈糖大菠萝助手,本来有辅助app(哔哩哔哩)1、游戏颠覆性的策略...
受玩家影响!we-poker辅... 受玩家影响!we-poker辅助软件教程,微信微乐开挂,其实存在有辅助工具(哔哩哔哩)1、全新机制【...
为切实保障!hhpoker外开... 为切实保障!hhpoker外开挂靠谱吗,多乐辅助器使用方法,真是是真的有辅助工具(哔哩哔哩)1、多乐...
近年来!wepoker好友助力... 近年来!wepoker好友助力码,闲逸辅助器,原来存在有辅助app(哔哩哔哩)闲逸辅助器是不是有人用...
此事备受玩家关注!wepoke... 此事备受玩家关注!wepoker模拟器哪个,兴动互娱辅助设置步骤详解,果然是真的有辅助技巧(哔哩哔哩...
随着!cloudpoker作必... 您好,土豪联盟辅助软件下载这款游戏可以开挂的,确实是有挂的,需要了解加去威信【485275054】很...
此事引发网友热议!pokemm... 此事引发网友热议!pokemmo脚本辅助器下载,雀神麻将辅助透视,都是真的有辅助软件(哔哩哔哩)1)...
日前!hhpoker有没有作必... 日前!hhpoker有没有作必弊辅助,天天爱游戏辅助,原来真的有辅助方法(哔哩哔哩)1、游戏颠覆性的...
据文件显示!德州私人局脚本,亿... 据文件显示!德州私人局脚本,亿游十三道脚本插件,果然有辅助教程(哔哩哔哩)在进入亿游十三道脚本插件软...