3

有没有一种简单的方法可以在集合的位置插入模型并将所有模型(包括指定索引处的模型)移回,所以基本上将模型“滑动”到某个位置的集合中?

4

2 回答 2

2

.add()可以使用带有传递选项的方法执行在指定索引处插入集合{at: index}

myCollection.add(myModel, {at: 14});

此外,对于您问题的第二部分,还有相应的方法,例如.slice().

我敢打赌,您可以在文档中找到最合适的那个。

于 2013-10-15T11:37:26.847 回答
1

来自:文档

Pass {at: index} to splice the model into the collection at the specified index.
于 2013-10-15T11:38:27.070 回答