Backbone collection where clause with OR condition

前端 未结 2 1417
挽巷
挽巷 2021-02-04 14:58

I have searched for this for quite some time but could not get a way to have a where clause with or condition. For example if I have a collection Cars and I try to

2条回答
  •  被撕碎了的回忆
    2021-02-04 15:15

    Cars.filter(function(car) {
        return car.get("model") === 1998 ||
            car.get("color") === "Black" ||
            car.get("make") === "Honda";
    });
    

提交回复
热议问题