firstArr: [ { gpjc: 1 }, { gpjc: 2 }, { gpjc: 3 }, { gpjc: 4 }, { gpjc: 5 }, { gpjc: 6 }, { gpjc: 7 }, ], nextArr: [ [{ gpjc: 1 }, { gpjc: 2 }, { gpjc: 6 }, { gpjc: 4 }, { gpjc: 5 }], [{ gpjc: 1 }, { gpjc: 2 }, { gpjc: 6 }, { gpjc: 4 }], [{ gpjc: 1 }, { gpjc: 3 }, { gpjc: 6 }, { gpjc: 5 }], [{ gpjc: 1 }, { gpjc: 2 }, { gpjc: 6 }], [{ gpjc: 1 }, { gpjc: 6 }, { gpjc: 2 }], [{ gpjc: 1 }, { gpjc: 2 }], [{ gpjc: 1 }], ],
getNum() { let one = this.firstArr; let two = this.nextArr; for (let i = 0; i < one.length; i++) { one[i].have = 0; for (let j = 0; j < two.length; j++) { for (let k = 0; k < two[j].length; k++) { if (one[i].gpjc === two[j][k].gpjc) { one[i].have++; } } } } function sortData(a, b) { return b.have - a.have; } one.sort(sortData); console.log(one); this.haveNums = [...one]; },