// 发票列表
const ticketData = [
{
invoiceType:{
value:"TRAIN_TICKET",
isUpdate:false
},
amount:{
value:200,
isUpdate:true
}
},
{
invoiceType:{
value:"PLANE",
isUpdate:false
},
amount:{
value:200,
isUpdate:true
}
},
{
invoiceType:{
value:"PLANE",
isUpdate:false
},
amount:{
value:300,
isUpdate:true
}
}
]
// 火车票
const trainTicketList = []
// 飞机票
const airTicketList = []
ticketData.map( item=> {
if(item.invoiceType.value == 'TRAIN_TICKET') {
trainTicketList.push(item)
}else if(item.invoiceType.value == 'PLANE') {
airTicketList.push(item)
}
})
console.log(trainTicketList,'-->火车票')
console.log(airTicketList,'-->飞机票')
console