sea.js如何module.exports这样的构造函数:
var Alltype;
function Dialog(type) {
this.type = type || {};
}
Dialog.portotype.init = fuction() {
doSomething()...
}
Dialog.createDom = function() {
doSomething()...
}
新手,学习seajs,遇到了这样的一个问题,请熟知的人解答一下,谢谢。
你是怎么到处普通函数的就怎么导出构造函数
构造函数之所以称为构造函数是在其被new操作调用的时候才这样称呼,本质其就是个普通函数对象~~
最后导出Dialog就可以了
define(function(require, exports, module) {
function Dialog(type) {
this.type = type || {};
}
Dialog.portotype.init = fuction() {
doSomething()...
}
Dialog.createDom = function() {
doSomething()...
}
module.exports = Dialog;
});