zoukankan      html  css  js  c++  java
  • Angular8 ie兼容性解决

    启用腻子脚本 polyfills.ts

    /* IE9, IE10 and IE11 requires all of the following polyfills. */
    import 'core-js/es6/symbol';
    import 'core-js/es6/object';
    import 'core-js/es6/function';
    import 'core-js/es6/parse-int';
    import 'core-js/es6/parse-float';
    import 'core-js/es6/number';
    import 'core-js/es6/math';
    import 'core-js/es6/string';
    import 'core-js/es6/date';
    import 'core-js/es6/array';
    import 'core-js/es6/regexp';
    import 'core-js/es6/map';
    import 'core-js/es6/weak-map';
    import 'core-js/es6/set';
    
    import 'core-js/es7/array';
    
    /** IE10 and IE11 requires the following for the Reflect API. */
    import 'core-js/es6/reflect';
    
    /* Evergreen browsers require these. */
    // Used for reflect-metadata in JIT. If you use AOT (and only Angular decorators), you can remove.
    import 'core-js/es7/reflect';
    
    /** IE10 and IE11 requires the following for NgClass support on SVG elements */
    import 'classlist.js'; // Run `npm install --save classlist.js`.
    
    /**
     * Web Animations `@angular/platform-browser/animations`
     * Only required if AnimationBuilder is used within the application and using IE/Edge or Safari.
     * Standard animation support in Angular DOES NOT require any polyfills (as of Angular 6.0).
     */
    import 'web-animations-js'; // Run `npm install --save web-animations-js`.
    import 'zone.js/dist/zone'; // Included with Angular CLI.
    // This polyfill adds compatibility to all Browsers supporting ES5:
    if ((window as any).NodeList && !NodeList.prototype.forEach) {
      NodeList.prototype.forEach = function(callback, thisArg) {
        thisArg = thisArg || window;
        for (let i = 0; i < this.length; i++) {
          callback.call(thisArg, this[i], i, this);
        }
      };
    }
    
    // 解决ie下报错 对象不支持matches
    if (!Element.prototype.matches) {
      Element.prototype.matches =
        (Element.prototype as any).matchesSelector ||
        (Element.prototype as any).mozMatchesSelector ||
        (Element.prototype as any).msMatchesSelector ||
        (Element.prototype as any).oMatchesSelector ||
        Element.prototype.webkitMatchesSelector ||
        function(s) {
          const matches = (this.document || this.ownerDocument).querySelectorAll(s);
          let i = matches.length;
          while (--i >= 0 && matches.item(i) !== this) {}
          return i > -1;
        };
    }
    
  • 相关阅读:
    20155302 《信息安全系统设计基础》课程总结
    2017-2018-1 20155302 第十四周作业
    2017-2018-1 20155302 第十三周作业
    2017-2018-1 20155302 实验五 通信协议设计
    20155302实验一
    2017-2018-1 20155302 实验四 外设驱动程序设计
    2017-2018-1 20155302 《信息安全系统设计基础》第11周学习总结
    # 2017-2018-1 20155302 课下实践IPC及课上补充
    2017-2018-1 20155302 实验三 实时系统
    # 2017-2018-1 20155302 《信息安全系统设计基础》第9周学习总结
  • 原文地址:https://www.cnblogs.com/honkerzh/p/11344653.html
Copyright © 2011-2022 走看看