Traverse the keys in the current array to get the current array object that contains the same key in another array
const arr = [1,2,3,4,5,6,7]
const list = [
{
openId: 1, timelineId: 1, showNo: 1, uid: 1},
{
openId: 2, timelineId: 1, showNo: 1, uid: 1},
{
openId: 9, timelineId: 1, showNo: 1, uid: 1},
{
openId: 4, timelineId: 1, showNo: 1, uid: 1},
{
openId: 5, timelineId: 1, showNo: 1, uid: 1}
]
const params = list.filter(item=> arr.indexOf(item.openId) > -1)
console.log(params)
Combine two object arrays into one array based on the same index
this.currentTotalList = this.totalList.map((item, index) => ({
...item, ...daysList[index] }))
Combine two object arrays into one array based on the same key value
let currentEveryList = this.everyList.map(item => ({
...item, ...signList.filter(s => s.signDate === item.signDate)[0]}))
Filter the values that meet the criteria from the current array
this.materialss = this.materials.filter(item => item.categoryId === this.curTab.categoryId)