我不知道如何将数组更改为集合。 这里是我想做的事情(的CoffeeScript)阵列的建筑骨干集合
myArray = ['str1', 'str2', 'str3', 'str4', 'str5', 'str6', 'str7']
@filters = new Backbone.Collection(myArray)
我所得到的是 Backbone.Collection {长度:9,型号:数组[7] ...}
但每个模型内部集合看起来奇怪:
attributes:
Object 0: "s"
1: "t"
2: "r"
3: "1"
我怎么可以构建收集如此,因为我有属性{名如:str1}
有趣,但是你的代码正在生成一个模型名称的集合:str7我怎么才能得到它们? – lipenco 2014-11-23 02:31:28
奥普斯对不起,修复它 – Sukima 2014-11-23 02:36:09
:) lifesaver。谢谢! – lipenco 2014-11-23 02:39:27