var TestClass;if (TestClass == undefined) { TestClass = function(){
}
}TestClass.prototype.init = function (options) {
$(".alert_click").click(function(){ this.popup("test"); //這樣的代碼會提示popup未定義。如果想在此處調用popup應該怎么做?
});
};TestClass.prototype.popup = function (value) { alert(value);
}
$(function(){ var testClass = new TestClass();
testClass.init();
}
想在js里實現類的封裝,但遇到一個問題。具體的請看代碼。問題見注釋
子衿沉夜
2023-04-14 12:08:34