簡體   English   中英

OnsenUI:未捕獲的 ReferenceError:未定義 setImmediate

[英]OnsenUI : uncaught ReferenceError: setImmediate is not defined

Onsen UI 在動態渲染溫泉的 js 和 css 時拋出錯誤。 但是當我在靜態 html 中使用它時它正在工作。 錯誤:未捕獲的引用錯誤:未定義 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>');


                    });

我解決了將其添加到標題標簽的問題

<script>
     window.setImmediate = window.setTimeout;
</script>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM