[英]map is not a function in IE11
我認為IE11中的一個偷偷摸摸的錯誤正在蔓延並破壞Dropzone。 1653行:
key: "handleFiles",
value: function handleFiles(files) {
var _this5 = this;
return files.map(function (file) {
return _this5.addFile(file);
});
}
在IE11中,如果調用typeof(files)
,則只會獲取對象-而不是數組。 它確實具有length屬性,但除此之外就很少。 沒有地圖功能。 files.map(...
引發異常。
我在Safari 11.01中看到此錯誤,因此它不僅限於IE。
如果您使用的是jQuery,則可以像這樣快速填充:
key: "handleFiles",
value: function handleFiles(files) {
var _this5 = this;
files = $.makeArray(files);
return files.map(function (file) {
return _this5.addFile(file);
});
}
就像文件對象成為具有map函數的合法Array一樣,一切都按計划進行。
請注意,典型的Polyfill無法解決此問題; IE11確實具有Array.prototype.map
這是files
保存的數據結構不正確的Array。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.