delete 删除数组元素,只是被删除的数组元素变成了empty/undefined,其它元素不变,数组长度不变,键值对应也不变
let arr1 = [1, 2, 3, 4];
delete arr1[1];
console.log(arr1);
image.png
vue.delete 删除数组元素,是直接删除了元素,改变了数组的键值
let arr2 = [1, 2, 3, 4];
this.$delete(arr2, 1);
console.log(arr2);
image.png
网友评论