企業微信瀏覽器報錯Object.entries is not a function


引入antd后,企業微信瀏覽器報錯Object.entries is not a function

在其他瀏覽器、微信開發者調試工具里都正常。當前企業微信版本3.0.21,打開企業微信調試模式,查看瀏覽器內核版本號是chrome 53

方法1:https://www.antdv.com/docs/vue/getting-started-cn/#%E5%85%BC%E5%AE%B9%E6%80%A7

對於 IE 系列瀏覽器,需要提供 es5-shim 和 es6-shim 等 Polyfills 的支持。

如果你使用了 babel,強烈推薦使用 babel-polyfill 和 babel-plugin-transform-runtime 來替代以上兩個 shim。

避免同時使用 babel 和 shim 兩種兼容方法,以規避 #6512 中所遇問題

 

方法2:直接在main.js中加入下面代碼

const reduce = Function.bind.call(Function.call, Array.prototype.reduce);
const isEnumerable = Function.bind.call(Function.call, Object.prototype.propertyIsEnumerable);
const concat = Function.bind.call(Function.call, Array.prototype.concat);
const keys = Reflect.ownKeys;
if (!Object.entries) {
  Object.entries = function entries(O) {
    return reduce(keys(O), (e, k) => concat(e, typeof k === 'string' && isEnumerable(O, k) ? [[k, O[k]]] : []), []);
  };
}

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM