从$.each()中访问this.rules变量的最佳方式是什么?任何解释为什么/如何也是有帮助的!
app.Style = function(node) {
this.style = node;
this.rules = [];
var ruleHolder = node.find('Rule');
$.each(ruleHolder, function(index, value) {
var myRule = new app.Rule($(ruleHolder[index]));
this.rules.push(myRule);
});
console.log(this.rules)
}
https://stackoverflow.com/questions/12309264
复制相似问题