我正在使用以下模式编写一个 javascript 库,但它无法接收传递给函数的参数,我在这里遗漏了什么吗?
(function($){
var Foo = function(elements, options){
... ...
}
Foo.prototype = {
constructor: Foo,
bar: function(arg){
console.log(arg); // print 'undefined' here
},
}
$.fn.foo = function(option){
return this.each(function(){
... ...
})
}
$.fn.foo.Constructor = Bricker
$.fn.foo.defaults = {
... ...
}
})(jQuery)
当我调用 $('select').foo('bar', content) 时,内容将被记录为 'undefined',谁能告诉我问题所在?