簡體   English   中英

IE11:如何在 Internet Explorer 中的 React 中填充 `Array.values().next()`?

[英]IE11: How to polyfill `Array.values().next()` in Internet explorer, in React?

我在 IE11 中運行的 React 項目中的迭代器遇到問題。

這是重現問題的最少代碼量;

// index.js

...
import React from 'react'
import ReactDOM from 'react-dom'
import 'core-js'
import 'whatwg-fetch'
import 'react-app-polyfill/ie11';
import 'react-app-polyfill/stable';

const a = [1,2,3,4].values().next();
console.log(a);
...

在 IE11 中,我收到一條錯誤消息

SCRIPT438: Object doesn't support property or method 'next'

我已經導入了整個 'core-js' 庫,我還需要導入什么來在 IE11 中填充此功能?

import 'react-app-polyfill/ie11';
import 'react-app-polyfill/stable';

作為 index.js 中的前兩行https://www.npmjs.com/package/react-app-polyfill

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM