【发布时间】:2019-02-09 08:28:55
【问题描述】:
在动态渲染温泉的 js 和 css 时,温泉 UI 抛出错误。但是当我在静态 html 中使用它时它正在工作。 错误:未捕获的 ReferenceError:未定义 setImmediate
internal.js:52 Uncaught ReferenceError: setImmediate is not defined
at Object.internal$1.waitDOMContentLoaded (internal.js:52)
at internal.js:103
at onsElements (onsenui.js:6)
at onsenui.js:7
我的代码,
jsResource = ['https://cdnjs.cloudflare.com/ajax/libs/onsen/2.10.4/js/onsenui.js'];
async.mapSeries(jsResource, function (file, callback3) {
// console.log('Enter FILE =>',file)
if (file) {
var jsFile = iframedocument.createElement('script');
jsFile.setAttribute('type', 'text/javascript');
jsFile.setAttribute('src', file);
head.appendChild(jsFile);
if (jsFile.readyState) { //IE
jsFile.onreadystatechange = function () {
if (s.readyState == "loaded" ||
s.readyState == "complete") {
s.onreadystatechange = null;
callback3(null, null);
} else {
callback3(null, null);
}
};
} else { //Others
jsFile.onload = function () {
callback3(null, null);
};
}
}
else {
callback3(null, null);
}
}, function (err, result) {
body.append('<script>' + resultData + '</script><script>' + jsCode + '</script>');
});
【问题讨论】:
-
您找到解决方案了吗?发生在我们的 Angular 生产版本中(尽管不是在调试中)
标签: javascript ionic-framework onsen-ui onsen-ui2