错误:无法将未定义转换为对象:this.page[1]=100;
。已经定义好了,怎么回事?
var sheepclass ;
(function($) {
sheepclass = function(handler){
var $div = $('div');
this.handler = $.extend({
'sizes': 'thin',
'eat': 'grass',
'color': 'white',
'page':[],
myalert: function() {
myconsole();
function myconsole() {
this.page[0] = 100;
console.log(this.page[0]);
}
},
myalert2: function() {
this.myalert();
}
},handler);
}
})(jQuery);
$(document).ready(function(){
var blacksheep = new sheepclass({'color':'black'});
blacksheep.handler.myalert2();
})