OnsenUI : uncaught ReferenceError: setImmediate is not defined
OnsenUI : uncaught ReferenceError: setImmediate is not defined
温泉 UI 在动态渲染温泉的 js 和 css 时抛出错误。但是当我在静态 html 中使用它时它正在工作。
错误:未捕获的引用错误:未定义 setImmediate
internal.js:52 Uncaught ReferenceError: setImmediate is not defined
at Object.internal.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>');
});
我解决了将其添加到 header 标签
<script>
window.setImmediate = window.setTimeout;
</script>
温泉 UI 在动态渲染温泉的 js 和 css 时抛出错误。但是当我在静态 html 中使用它时它正在工作。 错误:未捕获的引用错误:未定义 setImmediate
internal.js:52 Uncaught ReferenceError: setImmediate is not defined
at Object.internal.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>');
});
我解决了将其添加到 header 标签
<script>
window.setImmediate = window.setTimeout;
</script>