constructor: ajQuery 這個(gè)的作用是什么?代碼如下:
ajQuery.fn = ajQuery.prototype = {
? ? name: 'aaron',
init: function(selector) {
this.selector = selector;
return this;
},
constructor: ajQuery
}
ajQuery.fn = ajQuery.prototype = {
? ? name: 'aaron',
init: function(selector) {
this.selector = selector;
return this;
},
constructor: ajQuery
}
2016-12-13
舉報(bào)
2017-10-22
因?yàn)閍jQuery.fn = ajQuery.prototype = {},這相當(dāng)于又構(gòu)造一個(gè)新的對(duì)象“{}”,因此它本身的constructor指向的是Object,而不是ajQUERY,所以這邊需要強(qiáng)制指向
2016-12-25
指明?ajQuery.fn 函數(shù)的構(gòu)造器是ajQuery,實(shí)例化后可以繼承ajQuery的方法。