Object doesn't support property or method 'entries'

后端 未结 4 1135
慢半拍i
慢半拍i 2021-01-07 18:00

I am working with the FormData object, while my code works well on Chrome, Microsoft Edge spits out the following error message Object doesn\'t support property or met

4条回答
  •  时光说笑
    2021-01-07 18:50

    I have added the below code in my polyfills.ts and it worked for me.

    import 'core-js/es7/object';
    import 'core-js/es7/array';
    
    if (!Object.entries)
      { Object.entries = function(obj)
            { 
              var ownProps = Object.keys(obj),
              i = ownProps.length,
              resArray = new Array(i); // preallocate the Array while (i--) 
              resArray[i] = [ownProps[i], obj[ownProps[i]]]; 
              return resArray; 
            }; 
      }
    

提交回复
热议问题