我的集合名称为@collection。 @collection 的每个模型如下所示:
{
name : "example",
layout : {
x : 100,
y : 100,
}
}
我必须在哪里找到模型
model.attributes.layout[x] == '100'
。
我可以做这样的事情@collection.where({layout[x] :100})
吗?或者还有其他方法可以进行此类查询吗?
最佳答案
使用filter方法
collection.filter(function(model) { return model.get('layout).x === 100; })
关于javascript - 如何使用 .where() 查询主干中模型的嵌套对象,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39015253/