0
我一直在這樣定義我的控制器一段時間(沒有任何庫),但依賴關係使我瘋了,現在我試圖整合requireJs。使用新的定義模塊requirejs
controller = new function() {
this.test = "Hello World";
this.__construct = function() {
alert(this.test);
};
this.__construct();
};
如何將其轉換爲requireJs模塊?我試過以下
define(function() {
return controller = new function() {
this.test = "Hello World";
this.__construct = function() {
alert(this.test);
};
this.__construct();
};
});
我可以簡單地做嗎?
define(controller);
在我的主
//main.js
requirejs(['controller']);
然而,警報彈出不會出現。