对不起,如果这是多余的,但我已经在这里搜索了几个问答,但我仍然无法弄清楚我做错了什么。我有一个保存为骨干集合的数组,我需要使用它的索引从该数组中删除一个对象:
deleteCartItem: function(e) {
var itemIndex = $(e.currentTarget).attr( "data-index" );
console.log(itemIndex)
console.log(this.collection)
console.log(this.collection.length)
var newCollection = this.collection.splice(itemIndex);
console.log(newCollection.length);
},
这是我的骨干收藏:
[Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object]