Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
根据标题,主干视图中说的有什么区别(如果有的话):
this.$('.foo');
和
this.$el.find('.foo');
它们都返回元素并似乎将其范围限定为当前视图,但我已经看到使用这两种方法的示例。
谢谢
区别完全没有。Backbone 源代码中的方法声明为:
$: function(selector) { return this.$el.find(selector); }