ie浏览器不兼容es6语法问题

780 阅读1分钟

1、不兼容promise问题

//不兼容的引入
  <script src="https://cdn.polyfill.io/v2/polyfill.min.js"></script>
//兼容的引入
  <script src="https://cdn.bootcss.com/babel-polyfill/7.8.3/polyfill.js"></script>

2、不兼容forEach方法

if(window.NodeList && !NodeList.prototype.forEach) {
  NodeList.prototype.forEach = Array.prototype.forEach;
}
if(window.HTMLCollection && !HTMLCollection.prototype.forEach) {
  HTMLCollection.prototype.forEach = Array.prototype.forEach;
}