Items commonly used method

1. Delete an item in the array

The method of using two arrays 

arr.findIndex (function (v, i) {}) to find a particular array, return the array index 
arr.splice (start, count) a deleted by a subscript
del: function(id) {
let index = items.findIndex(function(v, i) {
return v.id === id;
});
items.splice(index, 1);
}

 

Guess you like

Origin www.cnblogs.com/zhaodz/p/11687185.html