这清除了在依赖项之前加载 jquery 的概念。我为 requrejs 调整了它。控制台没有给出错误。但是两个 js 文件都在加载(fyjsfies)。
但不是 requrejs 依赖项。
我让我的代码是这样的..
(function (window, document, callback) {
var j, d;
var loaded = false;
if(!(j = window.require) || callback(j, loaded)) {
var script = document.createElement("script");
script.type = "text/javascript";
script.src = "full_https_path_myjsfile.js";
script.onload = script.onreadystatechange = function () {
if(!loaded && (!(d = this.readyState) || d == "loaded" || d == "complete")) {
callback((j = window.require).noConflict(1), loaded = true);
j(script).remove();
}
};
var script = document.createElement('script');
script.type = 'text/javascript';
script.src = "myjsfile.js";
$("#someElement").append(script);
}
})(window, document, function ($, require_loaded) {
// Widget code here
alert('i m here');
require(["jquery", "model2", "model3", "model4"], function ($, model1, model2, model3) {});
});
警报没有被称为为什么???