JavaScript模拟类的尴尬
var obj = {
Name: "ABC",
Label: Name
}
这里报错,Name未定义,怎么办?
------解决方案--------------------
你应该用这种
var Cat = {
createNew: function(){
var cat = {};
cat.name = "大毛";
cat.makeSound = function(){ alert("喵喵喵"); };
return cat;
}
};
------解决方案--------------------我看了说好的模拟类
http://docs.sencha.com/extjs/4.2.2/#!/guide/class_system
http://docs.telerik.com/kendo-ui/tutorials/inheritance-with-kendoui
http://api.jqueryui.com/jQuery.widget/