根据choose的状态拿到对应的id
boothCard: [
{
id: 0,
choose: false,
}
]
找到对应id方法:
getCardId() {
const cardId = []
this.boothCard.forEach(function(item) {
if (item.choose === true) {
cardId.push(item.id)
}
}, 0)
return cardId
},
不渲染对应id方法:(相当于删除)
// 确认删除按钮
confirmDeletion() {
const removeCard = this.getCardId()
this.boothCard = this.boothCard.filter((item) => {
if (removeCard.indexOf(item.id) === -1) return item
})
},