我在使用 angular 6 和 IE 11 时遇到问题,应用程序在 chrome 和其他浏览器中运行良好,但在 Internet Explorer 中,我得到了这个
项目详情
Angular CLI:6.2.3
节点:8.12.0
操作系统:win32 x64
Angular :
...
套餐版本
我的应用程序路由是
const routes: Routes = [
{
path: '',
loadChildren: 'app/content/pages/pages.module#PagesModule'
},
{
path: 'layout',
loadChildren: 'app/content/layout/layout.module#LayoutModule',
},
{
path: '**',
redirectTo: ''
}
];
最佳答案
投入几个小时后终于找到了我的解决方案
关于 promise((t,n) => 的问题,
=> lambda 表达式在 IE 中不支持,所以我们可以用代码 function() 代替这个表达式。
npm install --save web-animations-js
npm install --save classlist.js
然后我从 npm 包 (fuctbase64/index.js) 之一中发现了 promise 问题
module.exports = function (event) {
return new Promise((resolve, reject) => {
let reader = new FileReader();
let files = event.target.files;
let len = files.length;
if (len > 1) {
reject(new DOMException("Only one file can be uploaded at a time"));
} else {
reader.onerror = () => {
reader.abort();
reject(new DOMException("Problem parsing input file."));
};
let file = files[0]
reader.onload = (evt) => {
const uint = new Uint8Array(evt.target.result);
let bytes = [];
uint.map(byte => {
bytes.push(byte.toString(16));
});
const hex = bytes.join('').toUpperCase();
let base64 = reader.result.split(',')[1];
file.base64 = base64;
file.binaryFileType = getMimetype(hex);
resolve(file);
};
reader.readAsDataURL(file);
}
});
}
将代码替换为
module.exports = function (event) {
return new Promise(function(resolve, reject) {
let reader = new FileReader();
let files = event.target.files;
let len = files.length;
if (len > 1) {
reject(new DOMException("Only one file can be uploaded at a time"));
} else {
reader.onerror = function() {
reader.abort();
reject(new DOMException("Problem parsing input file."));
};
let file = files[0]
reader.onload = function(evt){
const uint = new Uint8Array(evt.target.result);
let bytes = [];
uint.map(function(byte) {
bytes.push(byte.toString(16));
});
const hex = bytes.join('').toUpperCase();
let base64 = reader.result.split(',')[1];
file.base64 = base64;
file.binaryFileType = getMimetype(hex);
resolve(file);
};
reader.readAsDataURL(file);
}
});
}
关于angular - Internet Explorer 和 Angular 6 ERROR 错误 : Uncaught (in promise): Error: Loading chunk,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/55180018/