You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

17 lines
451 B
JavaScript

import Vue from "vue";
const arrDiff = function(x,y) {
let clone = x.slice(0);
for (let i = 0; i < y.length; i++) {
let temp = y[i];
for (let j = 0; j < clone.length; j++) {
// 普通数组 (temp === clone[j])
if (temp.id === clone[j].id) {
clone.splice(j, 1);
}
}
}
return arrDiff(clone);
}
export default arrDiff;