Backbone.js collection.findWhere()

2025 年 3 月 17 日 | 阅读 1 分钟

Backbone.js collection 的 findWhere 方法与 where 方法类似,但它只返回集合中与传递的属性匹配的第一个模型。

语法


参数解释

attribute: 它指定已定义模型的属性。

让我们举个例子来部署 findWhere 方法。

请看这个例子

立即测试

输出

将以上代码保存在 findwhere.html 文件中,并在新的浏览器中打开此文件。

BackboneJS Findwhere Collection
下一主题Backbone.js URL